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 have two servers, let's call them first and second. First one is where the real development is done, and second one should be the replica. What I would like to do is put "git push" in post-receive, but there is one problem. Post-receive is executed as the user doing git push to first server, so I can't chmod 600 ssh key with no pass. What is the best practice for this? Thanx!

share|improve this question
"Post-receive is executed as the user doing git push to first server" <- why should that be a problem? – joschi May 29 '10 at 7:25

Just not give to developers direct SSH to user that running git on 1st server. Use gitolite to use singe git account on server with key-based authorization without shell access.

share|improve this answer
As a bonus, gitolite3 does mirroring, which is exactly what OP wants to accomplish. – mricon Dec 14 '12 at 16:50

Your Answer


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