Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers 2

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
add comment

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
add comment

Your Answer

 
discard

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.