Note: this is really more of a comment than an answer (but is too big to be a comment). See the linked duplicate for actual answers.
Some kind of configuring is required, because if it were not, I could make your computer do bad things by the simple act of you cloning a repository I control. Hooks can run arbitrary commands, after all.1
That said, if your users have configured at least one hook, that one hook can use Git to obtain and install more hooks. So, pick a hook that will be run, have your users configure it, and then have them run a Git operation that runs that one hook. That one hook can then do everything else.
Which hook should you use? That's up to you; the githooks documentation tells you which ones Git runs, when. The most obvious candidates are the post-checkout
, post-merge
, and pre-commit
hooks.
Beyond this point, it's just a small matter of programming.
1There was a dreadful bug in old versions of Git: they would allow people to store files named, e.g., .GIT/hooks/post-checkout
and .gIt/hooks/post-merge
. This had no harmful effect on Linux systems, but caused problems on MacOS and Windows. Modern Git checks for, and rejects, such files, both on the way into a repository and on the way out (in case of Evil Wizards making bad repositories by stealth and/or trickery).