Why are cloned repositories sometimes missing .git / hooks?

I have several (Git for Windows 2.6.2 64-bit) repositories that I created and started using the same way:

  • Run git init --bare <repoName>.git in Git Bash.
  • Clone a new repo using SourceTree.
  • Add and transfer source files (via SourceTree or EGit).
  • Blah blah blah...

When trying to add a general post-commit cache to these cloned repositories, I noticed that only some of them have a .git/hooks directory. Why?

I dug questions / answers regarding missing .git/hook directories and found nothing on SO or more broadly. Git documentation mentions that repo initialization ensures that ( .git/hooks/ ) .sample are executed by default; but I really couldn't find anything that seemed to explain why my cloned repositories sometimes contain .git/hooks , and sometimes not.

Can anyone shed light on the cause and effect here? Thanks.

+5
source share
1 answer

Certain interceptors in the git repository are always local to that repository. They are not part of the git history and are not transmitted when cloned, fetched, or clicked.

Thus, simply by cloning an existing repo with hooks, the clone repository will not have any of the upstream hooks. You will need to add them manually to the cloned repository.

This question explains some options that will help you achieve this.

+3
source

Source: https://habr.com/ru/post/1235830/


All Articles