问题
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/*
回答1:
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:
- "gitolite and file permissions"
- "Permission problems with Git sharedRepository"
- "Setting umask in Git / Gitolite"
来源:https://stackoverflow.com/questions/10109219/gitolite-hooks-do-not-execute