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.

Just got gitolite installed on my webserver and am trying to get a post-receive hook that can point the git dir in apache's direction.

This is what my post-receive hook looks like. Got this script from the Using Git to manage a web site.

echo "post-receive example.com triggered"
GIT_WORK_TREE=/srv/sites/example.com/public git checkout -f

This is the error response i'm getting back from git push origin master from my local workstation. These are files from within my repository.

remote: post-receive example.com triggered
remote: error: unable to create file .htaccess (Permission denied)
remote: error: unable to create file .tm_sync.config (Permission denied)
remote: fatal: cannot create directory at 'application': Permission denied

Permissions of public.

drwxr-xr-x 5 root root 4096 Jun 26 17:23 public
share|improve this question
Which user have you set up gitolite to use? What are the permissions of /srv/sites/example.com/public? Have you tried going through the SSH troubleshooting guide for gitolite and the document linked from there? –  Mark Longair Jun 27 '12 at 3:12
I ended up making the post-receive hook run another script in sudo (needed to add my git user to sudoers). –  ThomasReggi Jun 28 '12 at 15:32
I also posted on stackoverflow, sew me, It got much better response there. stackoverflow.com/questions/11211950/… –  ThomasReggi Jun 28 '12 at 15:32
I was just trying to help, since you'd particularly asked on Twitter - there's no need to be rude. –  Mark Longair Jun 28 '12 at 16:13
@MarkLongair the sew me comment wasn't directed at you just wanted to leave a trail so that if anyone searched for this post they'd be able to start from where I left off. –  ThomasReggi Jun 28 '12 at 16:27

Your Answer


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

Browse other questions tagged or ask your own question.