3

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?

3

The solution is called ssh-agent. It can remember your passphrase for the session. You run the agent with

eval `ssh-agent`

(might be even running in your session already, so check before using ssh-add -l) and add the key to the agent using:

ssh-add /path/to/your-private-key

it will prompt you for a passphrase. The further connections using this key will not prompt you for the passphrase.

  • Also ssh -A can let ssh sessions on the remote shell talk to your local ssh agent. – Thorbjørn Ravn Andersen Sep 6 '18 at 20:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .