If you are like me, you might have many accounts to online project hosting services. I have 1 codesion, 2 github and 1 beanstalk. On top of this you might also work at different places: at the office, at home, and so on.

I like to use git with the command line and it took me while to find out some really useful commands to manage the ssh keys.

All these services manage their access with ssh public key. To create them, it is easy, just follow the wonderful Github guide:
http://help.github.com/mac-set-up-git/

The following tips are working on a Mac, I have no idea if they would on Windows, I suspect Linux will work.

But sometimes you get:

Permission denied (publickey,keyboard-interactive).
fatal: The remote end hung up unexpectedly

Even though you generated created that key last week, it doesn’t seem to be there anymore. You probably have the key in your folder (/Users/my_user/.ssh) but the terminal doesn’t use it.

So first command, list the identities that are in use:

ssh-add -l

To remove an identity:

ssh-add -d /Users/my_user/.ssh/keyfile_name

And to add one:

ssh-add /Users/my_user/.ssh/keyfile_name

That’s it, very simple, but now you can manage your keys.

If you have other tips, please comment!

Share and Enjoy!