Why doesn't my post-checkout hook fire when creating a new worktree in a bare repository?

53 views Asked by At

I want to run a post-checkout script whenever I git worktree add <branch> in my bare repository.

So far I've:

  • bare cloned the git repo and cd'd into it.
  • created hooks/post-checkout with a simple echo foo
  • set chmod +x hooks/post-checkout
  • run git worktree add master

However, the post-checkout hook isn't run... or at least my echo isn't visible.

Is there something I'm missing or misunderstanding?

Appreciate any help!

1

There are 1 answers

0
Sebastian Nemeth On BEST ANSWER

In this case, it was husky that was changing the git hooks dir in git config. It was enough to simply commit the post-checkout hook to the repo under .husky/