Stash is now known as Bitbucket Server.
See the

Unknown macro: {spacejump}

of this page, or visit the Bitbucket Server documentation home page.

Hooks in Stash provide a way to customise a team's workflow and integrate with other systems. Stash currently supports two types of hooks, pre and post-receive


Managing hooks

Administrators can see the hooks that are available in Stash by going to Settings > Hooks for a Stash repository. Once installed, hooks are available across all repositories in a Stash instance, but are enabled separately on each repository in a project. 

Click the 'pen' icon beside the name of a hook to edit configuration details for the hook.

Stash currently ships with the following hooks:

  • Reject Force Push – block all Git force pushes (git push -- force).
  • HipChat Push Notifications – send a message to a HipChat room when someone pushes to the repository.

Pre-receive hooks

The first hook to run when handling a push from a client is the pre-receive hook. It can reject pushes to the repository if certain conditions are not fulfilled. You can use this hook to prevent force pushes to the repository or check whether all commits contain a valid JIRA issue key.  

Post-receive hooks

The post-receive hook runs after the commits have been processed and can be used to update other services or notify users. For example a post-receive hook can be used to send a message to a chat server or notify a continuous integration server of the newly pushed changes.

Getting hooks from the Atlassian Marketplace

A number of hooks are available from the Atlassian Marketplace. You can find and install these from within Stash – simply use the Add hook button on the hooks settings page to view available hooks from the marketplace. See Managing add-ons for details.

Creating your own hooks

Developers can write receive hook plugins for Stash using a simple API that provides a simple way to create a configuration interface, and stores the hook's configuration settings on a per-repository basis. 

For information about how to write your own hooks please see the Stash developer docs.

In particular, these pages will be helpful:

Learn more about Git hooks

Hooks in Stash are executed on the server, but Git itself also provides support for client-side hooks meant for client operations such as committing and merging. Learn more about Git hooks in the Git documentation

  • ラベルなし