7

I'm working on remote servers and I need to do a git clone from a another server using my private key. But I don't want to store my key on the remote servers.

I want to avoid storing ssh key on the remote servers at all, even in a temporary file. Is this possible?

Chris S
  • 77,945
  • 11
  • 124
  • 216
iafonov
  • 173
  • 1
  • 4

2 Answers2

7

You want to use ssh-agent - this is an exact scenario for which it was designed.

ssh-agent provides authentication forwarding when you have used ssh to login to a remote server.

After configuring it, you can login to the remote server (using -A to forward the agent) and then do the git pull. It will forward the authentication request back to your local machine.

MikeyB
  • 39,291
  • 10
  • 105
  • 189
4

If you put your private key into environment variable it will not be much more secure. Note, that all environment variables are visible via /proc/$PID/environ. Use ssh-agent.

Michał Šrajer
  • 856
  • 5
  • 11