Make a git deployment owned by www-data

Viewed 2927

My post-receive hook deploys to /home/repo, where my Apache virtual host is pointing. I would like /home/repo to be owned by www-data.

Should I add git to /etc/sudoers and allow it to execute a custom script that make chown -R www-data:www-data /home/repo as root after each pushing ? git don't seem to be able to do it as himself. Seems pretty insecure though.

Edit: post-receive is doing a git checkout -f and chmod -R 750 /home/repo under git user. I just leave git own /home/repo and added www-data (or any Apache user) to the git group so it can read it.

1 Answers
Related