Reputation: 1057
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.
Upvotes: 3
Views: 3211
Reputation: 9025
Interesting. Why do you care about user ownership? Setting up some flexible group permissions and adding Apache user to your git
group should be more than enough, in general. Other than that, I would really recommend you to take a look at Capistrano for deployment.
Upvotes: 1