Rijk
Rijk

Reputation: 11301

Gitolite post-receive hook not executable anymore after each gitolite-admin push

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?

Upvotes: 2

Views: 782

Answers (1)

Michel Jung
Michel Jung

Reputation: 3276

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)

Upvotes: 2

Related Questions