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

Using git push server I push to a remote bare git-repository via ssh. The git-repository on the server has a post-receive hook which runs git checkout -f in /var/www/vhosts/ (working tree) for deployment.

I get

error: git checkout-index: unable to create file README (Permission denied)


whenever the hook gets executed.

This makes sense to me, as the ssh-user "bob" does not own the directory "preview", so he has no write permissions.

root@www:~# ls -lh /var/www/vhosts/ | grep preview

drwxr-x--- 5 sumo psaserv 4.0K Mar 29 15:38 preview

Should I add "bob" to the "psaserv" group and chmod 775 the directory (which didn't work), or is this the complete wrong direction? Is the only option to connect to the server with "sumo" instead of "bob"?

I read up on unix permissions but still can not really figure out the proper way to solve this. Any pointers are appreciated!

share|improve this question
up vote 1 down vote accepted

Adding bob to psaserv group and chmod -R g+w /var/www/vhosts/ should sort it for you.

share|improve this answer
...assuming that giving the psaserv group write permission to that directory is acceptable. Where possible, let a user be the owner of locations where their files will live. – Jeff Albert Mar 30 '11 at 18:07
Awesome, that sorted it for me - thank you! Thanks for the comments. – leomelzer Mar 31 '11 at 10:40

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.