ssh agent forwarding for github deploys

Developer from somewhere

Kept receiving these errors when trying to execute commands on the remote server, ( with capistrano ) while forwarding my SSH keys:

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

This link offered the solution. I ran:

$ ssh-add -L

and the output was:

The agent has no identities.

Then, I’ve added the key:

$ ssh-add ~/.ssh/id_rsa

Confirmed that it appears in ssh-add -L:

$ ssh-add -L
ssh-rsa ....

And after this step, the ssh key was properly forwarded.