No suitable response from remote hg – Mercurial over SSh

If you get below error when trying to pull or update your Mercurial repository, chances are your SSH agent didn’t forward your key;

remote: Permission denied (publickey).
abort: no suitable response from remote hg!

To make sure your SSH agent have access to your key run below command:
ssh-add -l OR ssh-add -L
If you get “Could not open a connection to your authentication agent.” message, that means your key didn’t get forwarded by your agent.

First make sure ssg agent is running:
echo $SSH_AUTH_SOCK
The output shouldn’t be empty when running the above command.

To add your key to SSH agent run below commands:
eval $(ssh-agent)
ssh-add [your-key]

Alternatively, you can add details of your host to the ssh config file:
Add following lines to ~/.ssh/config file:

Host arbitrary-host-name
User user-name
ForwardAgent yes
HostName IP-address