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
If you are writing JavaScript, the best way to do this is with Husky. Husky has a postInstall script that will set up and manage your githooks. You can then configure precommit and prepush scripts in your package.json or a husky dotfile.
You can use this to run arbitrary scripts. I typically yarn lint and yarn test prepush.
If you are not using JavaScript, or you cannot use Husky, you can clone commit hooks onto developer machines and check them into a repo, but you cannot force developers to run them.
To check in your hooks, create a hooks directory somewhere in your repo. Then put your hooks there instead of the usual .git/hooks directory. This is the part you can enforce.
The other part depends on developer goodwill. To set your hooks folder as the hooksPath, each developer must run:
git config core.hooksPath hooks
Now all the hooks in the hooks folder will run as you would expect.