ssh-agent cheat sheet

Start ssh agent. The reason we need eval is the fact that the ssh-agent command returns environment variables which we need in the current session for SSH to find the agent.

eval $(ssh-agent)

Now we add the ssh keys we want to use

ssh-add

This by default adds the ~/.ssh/id_<algorithm> keys. If you want to add others, you have to specify them explicitly

ssh-add ~/.ssh/<your-private-key>