I had Ubuntu 10.04 and recently upgraded to 11.10. Additional SSH keys stopped working. I have keys bitbucket and github, which I have in the websites. How can I tell SSH to use one particular key for Bitbucket and another for GitHub?
So, I have a config:
Host bitbucket
HostName 207.223.240.182
User hg
IdentityFile ~/.ssh/bitbucket
When I call ssh bitbucket, ssh successfully logs in with the key and gets kicked out. But when I try hg pull, I see “no response from remote hg.” and the passphrase is not asked.
What can be done?
For the little explanation on why the config posted in the question doesn’t work but your answer does :
When you call
ssh bitbucket, ssh looks in your config file for a host namedbitbucketwhich is defined with theHostkeyword. Then, using theHostNamekeyword, you can define the real hostname to use. In your case, you’re definingbitbucketas an alias for the IP 207.233.240.182 which I assume is the one forbitbucket.orgIt wasn’t working for your mercurial commands because the remote server is probably defined as
bitbucket.organd not the aliasbitbucket. After you changed the config file to the one proposed in your answer, ssh can effectively match the remote server to the host name and everything is fine !FYI, you can also use wildcard for the pattern matching, for example :
Would also work, because when looking at the config, SSH will replace the * with anything else.