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

I have a system setup like this:


However no matter how I configure the shell environment (i.e. GIT_DIR and PWD) the git-pull command does NOT run when called by the hook. Literally there is NO output whatsoever.

My post-update looks like:

/git/Lunch.git/lunch-receive > lunch.txt

and my lunch-receive script looks like:

service myService stop
cd /usr/lunch
unset GIT_DIR
git reset --hard # necessary or the pull fails
git pull hub master # this line DOESN'T RUN grrrrr!
chmod u+x *.sh
chmod -R u+x bin
service myService start

Finally, lunch.txt (the output) looks like

HEAD is now at 5956c0b [old commit message]
share|improve this question

1 Answer 1

There is a very similar question here: http://serverfault.com/questions/107608/git-post-receive-hook-with-git-pull-failed-to-find-a-valid-git-directory.

The long and short of it is, you'll need to unset GIT_WORK_TREE; or to make sure it really takes, pass in the --git-dir and --work-tree parameters to your git pull.


share|improve this answer

Your Answer


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