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.
问题:
回答1:
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 .gitolite.rc
as $REPO_UMASK
$UMASK
(It is '$UMASK
' with GitoliteV3 or'g3' now).
Check if that does influence your checkout issue:
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.