I'm using post-receive-email hook from the Git distribution to send e-mails to certain users when Git repository is updated (hook invoked from post-receive).
All my repositories were managed manually. Now, I get so many repos and so many users and groups that I have to upgrade to some Git repository management system. I picked Gitolite.
But I am a bit at loss on how to configure the e-mail notifications.
Update: I will elaborate the question a bit:
First question is: Where should I put the hook and should I change it somehow so it would work with Gitolite?
Second question:
The standard post-receive-email hook depends on three parameters in *.git/config: hooks.envelopesender, hooks.emailprefix and hooks.mailinglist.
These parameters are, in general, different for each repository that I move under Gitolite. In practice, they are the same for the same permission groups — users, which have access to the repository, receive notifications, others — not.
I would like to avoid editing config file for each repository manually. It would be much more fun if I could configure everything in the same, centralized, place for whole Gitolite.
So, any hints?
You can look at the doc hook for starters:
where do I (the admin) put the hooks?
In general, all hooks go into the
hooks/commondirectory. Only the special post-update hook meant for theadminrepo goes intohooks/gitolite-admin.
But the GitoliteV3 doc on 'mirroring' provides an alternative to a custom hook.
For the second question:
I would like to avoid editing config file for each repository manually.
It would be much more fun if I could configure everything in the same, centralized, place for whole Gitolite.
The doc gitolite.conf is quite clear:
repo specific git config commands
Sometimes you want to specify
git configsettings for some of your repos.
For example, you may have a custom post-receive hook that sends an email when a push happens, and this hook needs to know whom to send the email to, etc.You can set
git configvalues by specifying something like this within a "repo" paragraph:example usage: if you placed a hook in
hooks/commonthat requires configuration information that is specific to each repo, you could do this:
repo gitolite
config hooks.mailinglist = [email protected]
config hooks.emailprefix = "[gitolite] "
config foo.bar = ""
config foo.baz =
The syntax is simple:
config sectionname.keyname = [optional value_string]
This does either a plain "
git config section.key value" (for the first 3 examples above) or "git config --unset-all section.key" (for the last example).
Other forms (--add, thevalue_regex, etc) are not supported.Note: this won't work unless the
rcfile has the right settings; please see comments around the variable$GL_GITCONFIG_KEYS$GIT_CONFIG_KEYS(now in GitoliteV3 or 'g3') in gitolitercfile for details and security information.
at the moment, this does not work:
repo @all
config foo.bar = "baz"
I presume you would like it to work, but it's kinda low on my list right now due to other pressures, and the fact that there is a workaround:
@almostall = repo1 repo2 repo3
@almostall = repo4 repo5 repo6 [add as many more as you like]
[... later ...]
repo @almostall
config foo.bar = "baz"
Hope that helps, and sorry about the oversight on the @all
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With