gitolite hooks not found

171 Views Asked by At

I'm having trouble running some scripts with the POST_CREATE hook on gitolite3.

I've red the documentation on non-core programms and how one can use the gitolite-admin repo to manage those. So far so good. So I went ahead and

  • Uncommented the LOCAL_CODE variable inside .gitolite.rc to point to a /local subfolder inside the gitolite-admin repo LOCAL_CODE => "$rc{GL_ADMIN_BASE}/local",

  • Added a script to run with the POST_CREATE hook

     POST_CREATE                 =>
     [
         'SetHead.sh',
         'SetHead',
         'local/SetHead.sh',
         'local/SetHead',
         'local/hooks/SetHead.sh',
         'local/hooks/SetHead',
         'local/hooks/common/SetHead.sh',
         'local/hooks/common/SetHead',
     ],
    
  • Ran gitolite setup --hooks-only

  • Created a new repository

Sadly the script doesn't seem to work or isn't even found? Any time I push the gitolite-admin repo to create a new repository I get the following warnings

remote: WARNING: skipped trigger 'SetHead.sh' (not found or not executable)
remote: WARNING: skipped trigger 'SetHead' (not found or not executable)
remote: WARNING: skipped trigger 'local/SetHead.sh' (not found or not executable)
remote: WARNING: skipped trigger 'local/SetHead' (not found or not executable)
remote: WARNING: skipped trigger 'local/hooks/SetHead.sh' (not found or not executable)
remote: WARNING: skipped trigger 'local/hooks/SetHead' (not found or not executable)
remote: WARNING: skipped trigger 'local/hooks/common/SetHead.sh' (not found or not executable)
remote: WARNING: skipped trigger 'local/hooks/common/SetHead' (not found or not executable)

/edit
Ok, apparently I got the paths wrong. The full path to the file on the server is

'/home/gitolite/.gitolite/local/hooks/common/SetHead.sh'

But this doesn't work either. Running the script directly on the server works as expected. I found a symlink to the script inside each repositories own hook folder. Does that mean it should work?

/edit2
Out of curiosity I've just put the script inside the /local/commands folder and enabled it by putting it's name in the ENABLE list in the .gitolite.rc file. For some reason this immediately worked...

2

There are 2 best solutions below

4
VonC On

Considering the documentation insists on providing the full path, I would test with:

  • full path in LOCAL_CODE (without relying on $rc substitution)
  • making sure SetHead.sh is in that path, with the same case (uper/lowercase)
  • making sure SetHead.sh is executable (chmod 755)
0
Vinci On

Finally... placing the script in /local/triggers worked. I got this idea from a book called "Gitolite Essentials" where they also use the triggers subdirectory for scripts triggered by POST_CREATE.

Why? I have no idea.