How to install hooks in gitolite

Fabio picture Fabio · Aug 29, 2011 · Viewed 8.8k times · Source

I've read all the documentation about hooks, similar questions and a lot of code but I can't track where is the error in my procedure. I need to install a simple hook in my gitolite installation (made with an rpm package on CentOS) so here is what I did:

To install gitolite (some time ago):

  1. Installed the rpm package
  2. # su - gitolite
  3. $ gl-setup /tmp/fabio.pub (as gitolite user)

Now to install the hook:

  1. Created a sample file post-update with the hook code in ~gitolite/.gitolite/hooks/common and chmod +x on it
  2. run gl-setup /tmp/fabio.pub again as stated here

But nothing happened, the exit status from the latest command is 0, but the hook file is not symlinked in any of the repository. So what's wrong with my procedure? Have I missed something?

Bonus questions:

  1. If I had understood the doc my procedure is the right one? I.e. should I run gl-setup every time I update any hook?
  2. In this way I install the shared hooks in every repository under this gitolite installation, is that right? Can I manually install an hook either as symlink to somewhere or just an executable script only for a given repository? Should I do that manually in the hook folder of the given repository? Should I care of hooks conflicts (i.e. would any custom hook for the single repository block any other shared hook with the same name)?

Don't know if this matters, my gitolite version is 1.5.9.1.

Answer

takeshin picture takeshin · Jun 28, 2014

In Gitolite v3 you may choose where to put your hooks editing LOCAL_CODE variable in .gitolite.rc. See the file source for more options (eg. enabling per repo custom hooks)

Then you put your hooks in the specified dir, make them executable and run gitolite setup --hooks-only.