ssh-add complains: Could not open a connection to your authentication agent

Your shell is meant to evaluate that shell code output by ssh-agent. Run this instead:

eval "$(ssh-agent)"

Or if you've started ssh-agent already, copy paste it to your shell prompt (assuming you're running a Bourne-like shell).

ssh commands need to know how to talk to the ssh-agent, they know that from the SSH_AUTH_SOCK environment variable.


Try this one:

$ ssh-agent /bin/sh
$ ssh-add $yourkey

This question has been also very well covered on Stackoverflow.

eval `ssh-agent -s`

ssh-add