Reputation: 129
I am trying to implement git hook commit on a server using these instructions: https://git-scm.com/book/be/v2/Customizing-Git-An-Example-Git-Enforced-Policy
I created file "update" (make it executable, put in hooks folder), and found that this file is not executed when I do git commit -m "my message"
and git push
- all these commands work perfectly, but 'update' file is not working (I tried with simple script "echo "Hello World" >> somefile.txt)
Where is the problem?
Upvotes: 2
Views: 2263
Reputation: 1329692
As commented above, the update
hook is a server side hook
It needs to be on the server you are pushing to, in the bare repo: repo.git/hook/update
That explains why a git commit
(local operation) does not trigger the server side hook.
For the rest, see the follow-up question.
Upvotes: 1