1

I'm using git with bitbucket, we've a pre-receive hook that checks commit message format, when the push is done from local to remote pre-receive hook works perfectly, but when the commit is done from bitbucket server the hook is not triggered.

Is there a way to trigger hook on modification from bitbucket server.

AILY
  • 345
  • 2
  • 3
  • 16

1 Answers1

0

This is the expected behavior of the pre-receive hook, actually. Git only calls the receive hooks (pre-receive and post-receive) when it receives pushes; those hooks are not called if there is no push. Commits that happen directly on the server are never pushed to the server - they're already there! - so pre-receive is never called.

Are you able to add that script as a pre-commit hook on the server? If so, that will only affect those directly-on-server commits, and thus address your edge case.

Jim Redmond
  • 4,139
  • 1
  • 14
  • 18