Automatic distribution of Git Hooks

Hi together,
i would like to use one pre-receive hook for multiple repositories. However, so far I have not found a way to make this work.

One possibility I came up with is to put the script for the hook in its own repository and then access the web address of that script in every hook. However, then the pre-receive hook would still have to be adjusted every time a new repository is created. I just avoid the problem that I don’t have to change my code in every repository just the one script.

Does anyone of you know a way to include the code for a pre-receive hook automatically in a new repository, maybe even the possibility to select it during creation?

Thank you.

1 Like