Stanislav Matšel
Stanislav Matšel

Reputation: 348

How create/add hook functions to git repository?

I tried add post-commit function to .git/hook repository in server site.

But when I clone repository post-commit not appear in ..clonefolder/.git/hooks repository.

May be this functions need to be register via cmd?

Can somebody help how rightly create/add new hook functions?

Upvotes: 0

Views: 154

Answers (1)

LeGEC
LeGEC

Reputation: 51810

Hooks are not versioned with a repo, and will not get cloned.

You can put the files somewhere in your base repo directory, and put symlinks from .git/hook to these files, but you will need to execute this setup step each time a new clone is made.

You may want to symlink the whole .git/hook directory, as suggested by several other answers :

for example

Upvotes: 3

Related Questions