Update 2014:
Ciro Santilli points out in the comments and in "Custom post-receive file using GitLab" that there is now (GitLab not using gitolite anymore) a way to setup custom hooks (GitLab 7.5.0+, Nov. 2014).
- Pick a project that needs a custom git hook.
- On the GitLab server, navigate to the project's repository directory.
For a manual install the path is usually/home/git/repositories/<group>/<project>.git
.
For Omnibus installs the path is usually/var/opt/gitlab/git-data/repositories/<group>/<project>.git
.- Create a new directory in this location called
custom_hooks
.- Inside the
custom_hooks
directory, create a file with a name matching the hook type.
For apre-receive
hook the file name should bepre-receive
with no extension.- Make the hook file executable and make sure it's owned by git.
- Write the code to make the git hook function as expected. Hooks can be in any language. Ensure the 'shebang' at the top properly reflects the language type.
For example, if the script is in Ruby the shebang will probably be#!/usr/bin/env ruby
.
Original answer (Apr. 2013)
That is a direct consequence of not using gitolite
, and replacing it with gitlab-shell
with GitLab5.x.
That is why you have gitlab-shell
Issue 14, about allowing custom update hooks.
For now, you would add to register that hook yourself for each repos on the Gitlab server, which isn't very convenient.