The result you see is consistent with the server rejecting your id_rsa key. ssh will check id_rsa , id_dsa and id_ecdsa , even if you do not specify them on the command line or load them into your ssh-agent.
If I fixed this problem, I would remove ssh-agent from the image and set your secret key on the command line.
Run this in a new shell that you close later so that you do not destroy the existing environment:
$ bash $ unset SSH_AGENT_PID SSH_AUTH_SOCK $ ssh -v -T -i ~/.ssh/id_rsa hg@bitbucket.org [...] $ exit
(ssh-keygen should ask for a password for your key)
If this works, I would double check that the key that your ssh agent provides is actually correct. You can
$ ssh-keygen -y -f ~/.ssh/id_rsa
And check that against your ssh-agent:
$ ssh-add -L
If the identifier in your agent is different, you must reset your keys with ssh-add -D and reload them. If it is not, I am not sure what. Hope this helps.
source share