With a one official repository as the remote, and multiple local repositories cloned from it, can a pre-commit hook be scripted on that main repository and be enforced on al
You can not have the pre-commit hook forced on peoples local repositories, but in your central repo you can still run a pre-receive hook.
F. ex I needed to be sure the commit messages obeyed certain rules (for trac integration etc) so I used following pre-receive hook, which checks every commit messages being pushed to the central repository, and will deny the push if it is not welformed.
#!/bin/sh while read rev_old rev_new ref do MALFORMED="$(git rev-list --oneline $rev_old..$rev_new | egrep -v '#[0-9]+' | awk '{print $1}' )" if [ x"$MALFORMED" != x ] then echo Invallid commit message on $MALFORMED exit 1 fi done
for more info see f.ex https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks