3

I want to implements repo based hooks in gitolite.

Is it Possible ?

I am using gitolite 3 (g3).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Anil Kumar
  • 516
  • 2
  • 6
  • 16

1 Answers1

2

Since Gitolite 3.6+, it is possible with "repo-specific hooks":

  • add this line in the rc file, within the %RC block, if it's not already present, or uncomment it if it's already present and commented out:
LOCAL_CODE => "$rc{GL_ADMIN_BASE}/local",
  • uncomment the 'repo-specific-hooks' line in the rc file or add it to the ENABLE list if it doesn't exist.

  • If your rc file does not have an ENABLE list, you need to add this to the POST_COMPILE and the POST_CREATE lists. Click here for more on all this.

  • put your hooks into your gitolite-admin clone, as follows:

# on your workstation
cd /path/to/your/gitolite-admin-clone
mkdir -p local/hooks/repo-specific
  • Now add your hooks to that directory, but instead of using the git "standard" names (pre-receive, post-receive, post-update), you use descriptive names (e.g. "deploy", "RSS-post", etc).

  • add them to the repos you want them to be active in, in your conf file. For example:

repo foo
    option hook.post-update     =   jenkins
repo bar @baz
    option hook.post-update     =   deploy RSS-post
  • add, commit, and push the admin repo.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • How how to Update Gitolite? – Anil Kumar Apr 09 '15 at 14:59
  • @AnilYadav If you have installed Gitolite from a clone of https://github.com/sitaramc/gitolite/, then http://gitolite.com/gitolite/gitolite.html#upgrading: 1/ Update your clone of the gitolite source. 2/ Repeat the install command you used earlier (make sure you use the same arguments as before). 3/ Run gitolite setup. – VonC Apr 09 '15 at 15:01
  • The Problem is the gitolite setup is done by another guy 2 years before, and the problem is i dont have any documentation for that. Is there any solution to this? – Anil Kumar Apr 10 '15 at 04:43
  • What exact version of Gitolite are you using? – VonC Apr 10 '15 at 04:45
  • It gitolite3 WORKING_CONFIGURARION-0-g772bc88 on git 1.7.1 – Anil Kumar Apr 10 '15 at 04:50
  • This should be part of the official documentation. – sjas Sep 12 '16 at 14:18