Global Git Hook support

Is there a way to set global git hooks?

Ultimately, what I want to do is that, on any push to any repository, I want to run some jobs on the repository, and then display some information to the User (when pushed via ssh). Our old gitolite system supported this by having its own hooks in ~/.gitolite/hooks/common. Is there anything similar in Gogs?

I can edit the post-receive hook for a single repository, and can get it to do what I want. However, we have well over a hundred repos, and new ones being created quite regularly, so setting this up once globally would be really useful!

Alternatively, is there a way to send a custom message from a Webhook response back to the User? At least with Webhooks we can define them per Organisation, so it is easier than editing every single repo.


I created a .gitconfig that refers to a template directory containing hooks:
templatedir = /home/git/git-template

Thanks! That did the trick!

I actually put my hook script external to the template, and soft-linked to it from in the template using a full path. That way, when repos use the template, they copy the link instead of the file, which means I can update the script without having to remove & re-init all the repos.