Script Post-Receive Hooks

Post-receive hooks fire after the push has been received and accepted. They are useful for providing a message to the client.

A typical usage of post-receive hooks is for passing information to a downstream process…​ for example:

  • triggering a build in your Continuous Integration system.

  • posting a message on your internal messaging system, eg HipChat, Slack, Lync.

  • sending mail, for instance when a branch has been created or merged.

You can combine these with conditions, for instance only posting on IM when there is a new commit on a release branch, or a new tag has been created.

If you don’t need to output a message to the client, it may be easier to listen for a RepositoryPushEvent.

Adding a Post-Receive Hook

Navigate to Admin → Script Post Hooks. Click a heading to add a hook. Choose Custom Post-Hook to use your own scripts to respond to pushes.

On this page