I had Ubuntu 10.04 and recently upgraded to 11.10. Additional SSH keys stopped working. I have keys
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 named
bitbucket which is defined with the
Host keyword. Then, using the
HostName keyword, you can define the real hostname to use. In your case, you're defining
bitbucket as an alias for the IP 126.96.36.199 which I assume is the one for
It wasn't working for your mercurial commands because the remote server is probably defined as
bitbucket.org and not the alias
bitbucket. 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 :
Host bitbucket.* HostName 188.8.131.52 User hg IdentityFile ~/.ssh/bitbucket
Would also work, because when looking at the config, SSH will replace the * with anything else.