1

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/domain.com/preview (working tree) for deployment.

I get

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

[etc...]

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/domain.com/ | 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!

1

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

  • ...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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.