I have different users for different github organizations, each with their own ssh keys. How can I easily switch between ssh keys for different accounts?
1 Answer
Its quite possible with a little configuration in the ~/.ssh/config file.
The trick is - the Host in the .ssh config does not have to be the real Hostname
# add the ~/.ssh/id_altUsername file for the new user on Github
# ssh -T git@github-altUsername # test it can connect
# git clone git@github-altUsername:alt_username/[repo].git
Host github-altUsername
HostName github.com
User git
IdentityFile ~/.ssh/id_altUsername
IdentitiesOnly yes