1

I'm attempting to create a script to chmod the repo files to a new group after a push occurs. To test hooks, I created a hook that creates a file in /tmp/ just to check that the hook is working. It is not however.

What I've done so far:
First I created a script (~/.gitolite/hooks/common/update.secondary), then ran gl-setup [pubkey]. After numerous tries doing this, I checked the main hooks directory (/var/gitolite/hook/common/) and the script was not there.

After that I put the script directly in /var/gitolite/hook/common/, ran gl-setup again, and it still did not run the hook.

The script executes fine as the gitolite user using

sh ~/repositories/[some project]/hooks/myscript

The script I'm using:

#!/bin/bash
touch /tmp/TESTFILE

The permission update script:

#!/bin/bash
chmod 750 -R /home/git/repositories/*
Jason Kaczmarsky
  • 1,666
  • 1
  • 17
  • 30
  • 2
    Did you make it `chmod+x` before running the `gl-setup`? – VonC Apr 11 '12 at 15:52
  • I did that using the first method. But not the second...and it works now that I have. – Jason Kaczmarsky Apr 11 '12 at 17:11
  • Excellent. I have published an answer for more visibility – VonC Apr 11 '12 at 17:16
  • However, it seems that returning to my original problem, changing the group permissions, does not work. I have updated my original post to include the script. Do the permissions get rewritten after the update.secondary script gets executed? – Jason Kaczmarsky Apr 11 '12 at 17:18
  • Tell me if http://stackoverflow.com/questions/9915482/gitolite-and-file-permissions/9915919#9915919 and http://stackoverflow.com/questions/7086325/setting-umask-in-git-gitolite/7103499#7103499 help here (or http://stackoverflow.com/questions/5455070/permission-problems-with-git-sharedrepository/5455127#5455127) – VonC Apr 11 '12 at 17:21
  • That seemed to do it. Thank you very much! – Jason Kaczmarsky Apr 11 '12 at 17:36

1 Answers1

2

The OP Jason Kaczmarsky mentions that:

  • putting the script directly in /var/gitolite/hook/common/
  • chmod+x said script before
  • running gl-setup

works and does propagate that script.

The first alternative mentioned by the OP is described in Gitolite man page "Using Hooks", but it depends on the installation method, which seems to be the root one here.

That being said, regarding chmod operation, you need to take into account the variable REPO_UMASK in your gitolite.rc, as explained in:

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250