2

I can't find any posts/articles on how to do this properly -- usually that means you're using it wrong, so I thought I'd ask here to check :)

I'm using Gitolite and it's working perfectly. I've implemented a common post-receive hook to be notified when one of my team members pushes a new commit, which I activated for their repos. The problem I'm having is, after each push (regardless of if the hook has changed or not) the file is overwritten with and gets the following permissions:

rwel@ve-git:~$ ls -la /home/git/.gitolite/hooks/common/
total 36
drwxr-xr-x 2 git git  4096 Jul  3 13:23 .
drwxr-xr-x 4 git git  4096 May  1 15:41 ..
-rw------- 1 git git 21002 Jul  3 13:23 post-receive
-rwxr-xr-x 1 git git   308 May 15 16:24 update

So, each time I do a gitolite-admin rwel$ git push origin, I then have to logon to the git server and manually do sudo chmod a+x /home/git/.gitolite/hooks/common/post-receive.

Is there a better way to do this?

Charles
  • 50,943
  • 13
  • 104
  • 142
Rijk
  • 11,032
  • 3
  • 30
  • 45
  • Are you using gitolite V2 (or g2, with gl-xxx commands) or Gitolite V3 (or g3) with `bin/gitolite` script? – VonC Jul 03 '12 at 12:11
  • look at serverfault: http://serverfault.com/q/221978 and http://serverfault.com/q/26954 --- dunno if i should post that as an answer though – helt Jul 03 '12 at 12:15
  • @VonC: sorry, forgot to mention. V3. – Rijk Jul 03 '12 at 12:27
  • @helt: those are both not answers for me. The `UMASK` is no good, as the owner doesn't even get x permissions (with a umask of 0). The other post (I think) explains how to set the permissions, but not how to keep them set correctly, right? – Rijk Jul 03 '12 at 12:32
  • What does your Linux system 'umask' return? (I ask after looking at http://stackoverflow.com/a/8598684/6309) – VonC Jul 04 '12 at 06:03
  • The umask on the Git server is `0022`. – Rijk Jul 06 '12 at 09:22
  • Did you resolve this question? – VonC Nov 19 '12 at 12:10
  • Yes, we resolved this by setting a cronjob that resets the permissions every minute. Couldn't find a better way unfortunately... I still find it strange that no one else has run into this problem. – Rijk Nov 19 '12 at 13:10

1 Answers1

2

I had the same Problem. Short answer is:

Check out the gitolite-admin repository on a unix machine, chmod +x your file and push it.

From now the file is executable, even when the repo is cloned on windows (since cloning on windows sets core.fileMode=false)

Michel Jung
  • 2,966
  • 6
  • 31
  • 51