-
Notifications
You must be signed in to change notification settings - Fork 19
Description
I have to admit I do not fully understand how githooks on the server are supposed to work.
After installation of githooks on the server with
sh -c "$(curl -fsSL https://raw.githubusercontent.com/rycus86/githooks/master/install.sh)" -- --only-server-hooks
and automatic or manual installation of githooks in all repositories on the server, I see that each repository's hook directory contains the appropriate template hooks.
Question is: How do I use these hooks?
I created a hook/.githooks/pre-receive hook script in one of the bare repositories on the server, similar to a script in the .githooks directory of a work tree in a user's local (obviously non-bare) repository, but it did not get called upon a user's "git push".
My use case is that for each repository on the server, I want the individual choice of running multiple server-side hooks each time a user does a "git push". These hooks should enforce various policies (some of them different for each repository) without a user having a chance of getting around them (e.g. by manipulating them in a local repository's .githooks directory). So my requirements are:
- The server-side hooks should reside only on the server (which should already work, as the server-side bare-repo
hooksdirectory will never get transferred to a user's local repository). - The server-side hooks should be specific for a repository. I have no idea where to put my hook scripts, maybe I overlooked something in the documentation.
- Optionally, for specified repositories, there should be centrally stored hook scripts. This is probably already possible via "shared hooks" (not yet tested, because I do not know where to put the actual hook scripts or a
.sharedfile). - There should be the possibility for multiple hook scripts for each event, just like with
.githooksin a local repository.
If githooks is not "the right tool for the job", please let me know, but now that I got your wonderful hammer, every git problem looks like a nail. :-}
Also let me know if I missed the whole thing in the documentation by pointing me to the right location and sending me a cone of shame. :)