Modified the pre-commit.sample file in git hooks and how to upload it to github?

I mean, I changed the contents of pre-commit.sample and changed the file name to pre-commit, but after git push and then git clone, I found that the files in .git / hooks/ are still in sample format.

do you need to configure pre-receive.sample??

Mar.18,2021

It is not a bug, it is a feature

.git / hooks/ is specifically designed for users to use locally for a simple reason:

  1. for creators, it is likely that ssh deployment keys and the like are put in, and it is dangerous to share them;
  2. to the recipient, I'm just git push . Why am I suddenly deleted? It is also dangerous to accept arbitrary code insertion into the git standard process.

so, if you want to share hooks, you need to explicitly put it in repo, just use symbolic links. Then configure an installation script (bashscript, makefile, package.json, etc), for the user to install explicitly.

Menu