using gitolite VREFs for update hook

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.

  • Using a git subrepo which has ANOTHER git subrepo in a mercurial repository, is this possible?
  • Git autocomplete in screen on mac os
  • Does a git clone/push/pull mirror the exact contents of the repos involved?
  • How to use a branch for a yeoman generator
  • How to download the project using the git-svn-id?
  • Changing the Git username
  • 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?

  • gitosis-init for 2nd user? (need to make a new owner for gitosis-admin)
  • Preventing git merge from confirming commit message
  • how to prevent unpushed submodules in git
  • Eclipse changes file mode from 644 to 755 on all files it touches
  • Is “git push --mirror” sufficient for backing up my repository?
  • What are the files from the 'make' of git that I actually need to run git?
  • 2 Solutions collect form web for “using gitolite VREFs for update hook”

    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

    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
    
    Git Baby is a git and github fan, let's start git clone.