2

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.

jmdesigner81
  • 153
  • 3
  • 12

1 Answers1

4

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 have rwx------ permissions. People who want to run gitweb 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 leading 0 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 or 0027, that would be chmod -R g+rX).
This is because umask only affects permissions on newly created files, not existing ones.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you clarifying this. I changed the variable $REPO_UMASK in the .gitolite.rc to 0027. I noticed that it changed permissions to drwx-rx--- so my guess is the umask value is wrong. I'm going to look into the right permissions. Thanks for your help! – jmdesigner81 Mar 29 '12 at 05:17
  • @jmdesigner81 sure, if `0027` doesn't work for you, try your original umask value, `0002`, for the `$REPO_MASK` value. – VonC Mar 29 '12 at 05:32
  • 1
    Thanks! It worked I appreciate it. I'm going to write an article on my blog about setting gitolite as a designer. I'm a designer. thanks again! :) – jmdesigner81 Mar 29 '12 at 16:35