I'm currently building a ubuntu (10.0.4 LTS) server on a VPS to host a WordPress based website.
I've got gitosis installed to host the remote repository and what I would like to do is plugin to the post receive
hook to update the WordPress theme when I git push
.
I'm getting a bit confused with users and permissions. As when we I run git pull
the files in /var/www
will be owned by the git user. Ideally I would like all files in the /var/www
to be owned by the same user as I think this would be safer?
I've currently got the /var/www
folder owned my the www-data user, after some reading I've realised this is not the best thing to do. I need a bit of help working out the best plan of action for this?
From the comments:
I wouldn't use gitosis for that kind of fine-grained control:
So, with Gitolite:
The umask
use for the Git repo checked out by the git user within a gitolite environment will be the one described in the doc section "most often used/changed variables"
The default
UMASK
that gitolite uses makes all the repos and their contents haverwx------
permissions. People who want to rungitweb
realise that this will not do.The correct way to deal with this is to give this variable a value like
0027
(note the syntax: the leading0
is required), and then make the user running the webserver (apache,www-data
, whatever) a member of the 'git
' group.If you've already installed gitolite then existing files will have to be fixed up manually (for a
umask
or0027
, that would bechmod -R g+rX
).
This is becauseumask
only affects permissions on newly created files, not existing ones.
From there, you can follow "install gitolite under "apache"".