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.

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!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Adding bob to psaserv group and chmod -R g+w /var/www/vhosts/domain.com/ 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

 
discard

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.