Modern Agility


Adding keys to SSH-Agent on (Snow) Leopard

Posted by Kenny Johnston on 05/21/2010

If you’re like me, you probably have several sets of SSH keys for your various authentication needs. However, when you go to use them you may discover, for whatever reason, that SSH-Agent is not aware of one or more of them. I ran into this issue today when using a new set of keys to clone a repository hosted on Github:

ERROR: Permission to username/repository denied to username.
fatal: The remote end hung up unexpectedly

Assuming SSH-Agent is running and you have your public and private keys (usually something like ‘id_rsa.pub’ and ‘id_rsa’) stored in ~/.ssh, you can easily add this key to ssh-agent:

ssh-add /Users/username/.ssh/name_of_your_private_key

You can then verify the keys SSH-Agent is aware of via:

ssh-add -l

Extra credit for Rails/Git/Capistrano/Deprec folks:

If you want to store your key’s pass phrase in your Keychain, use the -K option when adding your key to SSH-Agent. This will allow you to proxy your key through the servers you deploy code to the remote server your repositories reside on. More on this.

Tags: ssh, osx



Leave a Comment