Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 6 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.