ssh-add over ssh

ssh-add picks up the agent fine when using X11, but when logged into a remote ssh session:

michael@apollo:~$ ssh-add
Could not open a connection to your authentication agent.

Ah, we have to fire up ssh-agent and cut/paste the env variables…

michael@apollo:~$ ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-erlzEU7907/agent.7907; export SSH_AUTH_SOCK;
SSH_AGENT_PID=7908; export SSH_AGENT_PID;
echo Agent pid 7908;
michael@apollo:~$ SSH_AUTH_SOCK=/tmp/ssh-erlzEU7907/agent.7907; export SSH_AUTH_SOCK; SSH_AGENT_PID=7908; export SSH_AGENT_PID;
michael@apollo:~$ ssh-add
Enter passphrase for /home/michael/.ssh/id_dsa:
Identity added: /home/michael/.ssh/id_dsa (/home/michael/.ssh/id_dsa)
michael@apollo:~$

Thanks, Brandon! 😉