I have set up a gitolite repo on a ubuntu server which is intended to have developers clone/push projects we will be working on. I'm having a problem with the post-receive hook I have in a repo. I have a post-receive hook in a particular repo checking out to a particular directory on the server, in my case is /home/user/www/projects/. The problem is When an admin pushes a repo (git push origin), the hook checks out the project to the specified directory successfully and changes the permissions on the directory (project) being checked out. However, if a regular user pushes to the repo, then the the hooks checks out the project intact without changing permissions. I already checked umask on the server which is 0002 and it shouldn't be the issue here. I'm uninstalled and reinstalled gitolite but still having the same issue.
As explained in "Git CHMOD post-receive hook", the permission associated with the Git repo itself could matter here.
In Gitolite, that permission is configure in the
$UMASK (It is '
$UMASK' with GitoliteV3 or'g3' now).
Check if that does influence your checkout issue:
UMASKthat gitolite uses makes all the repos and their contents have
rwx------permissions. People who want to run
gitwebrealise 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 leading
0is required), and then make the user running the webserver (apache, www-data, whatever) a member of the '
If you've already installed gitolite then existing files will have to be fixed up manually (for a
0027, that would be
chmod -R g+rX).
This is because
umaskonly affects permissions on newly created files, not existing ones.