问题
I am trying to migrate from v2 to v3 of gitolite. The old way of doing a server-side commit message check was to put the check in a repo specific hook in myrepo.git/hooks/update.secondary
In v3 of gitolite, they advise the check to be put in a VREF. The documentation is a little confusing and I am hoping for clarification.
I have added the following in /home/git/.gitolite.rc
LOCAL_CODE => "$ENV{HOME}/.gitolite/our_hooks",
In my our_hooks directory, I created a VREF folder and put my old update.secondary script in there. In my gitolite-admin/conf/gitolite.conf file, I added the following to the repository I want the script to execute on:
repo myrepo
RW = @my_developers
- VREF/update.secondary = @my_developers
When I try to push, I get a notice that the VREF/update.secondary can not be found. If I change to
repo myrepo
RW = @my_developers
- /home/git/.gitolite/our_hooks/VREF/update.secondary = @my_developers
I don't get any complaints but the hook doesn't appear to run at all.
Am I missing the boat on how to get an additional update check to run using gitolite?
回答1:
The documentation around this is a little confusing, so hopefully this will help others trying to get a chained update hook working with gitolite v3.
Everything I've done above is correct, the missing piece was were my update.secondary script needed to reside.
In the gitolite-admin/conf/gitolite.conf, the configuration should look like:
repo myrepo
RW = @my_developers
- VREF/update.secondary = @my_developers
Then there is a VREF directory in the GL_BINDIR directory. Place your executable update.secondary file in that directory.
The GL_BINDIR is the directory that contains the gitolite binary you ran in order to run: gitolite setup
回答2:
To add to the (upvoted) OP nathasm's answer, I have no problem using a LOCAL_CODE
variable in my .gitolite.rc
file, as mentioned in the section "alternate location" of "customising gitolite".
However, I never managed to use an environment variable.
In other words, this won't work:
LOCAL_CODE => "$ENV{HOME}/.gitolite/our_hooks",
But this will:
LOCAL_CODE => "/home/git/.gitolite/our_hooks",
Using the full path means that any VREF or hooks declared in /home/git/.gitolite/our_hooks/VREF will be recognized
repo myrepo
RW = @my_developers
- VREF/update.secondary = @my_developers
来源:https://stackoverflow.com/questions/13870607/using-gitolite-vrefs-for-update-hook