Here's my situation:
I ssh into a server running OS X, and from that remote shell I want to perform pushes and pulls (via ssh) for a git repository whose local copy exists on this server and whose origin is on another server out in the internet. (In this specific case it's a bitbucket repo.) I have generated an ssh public/private key pair with a passphrase on the server and uploaded the public key to bitbucket.
Ordinarily when I would perform pushes and pulls on my local OS X system, I would do it through a window in Terminal.app, and I use OS X's keychain to handle my ssh passphrase so that I only have to type it in once per login session. But that doesn't work here because I'm working in a remote session.
Is there any way to not have to type in my passphrase every time, other than using a public/private key pair with no passphrase?
Best Answer
The solution is called
ssh-agent
. It can remember your passphrase for the session. You run the agent with(might be even running in your session already, so check before using
ssh-add -l
) and add the key to the agent using:it will prompt you for a passphrase. The further connections using this key will not prompt you for the passphrase.