Atlassian External Hooks Overview

Git Hooks are scripts that run automatically when a specific event takes place in a Git repository. For instance, when commit is pushed or pull request is merged.

Git Hooks have several benefits:

  • customizing Git’s behavior
  • triggering actions at key points in the development life-cycle
  • extending the default actions, that are performed when a repository changes
  • integrating with other systems

While it is possible to write a post- or pre-receive hook in any language in different git hosting platforms, Atlassian Bitbucket propose to the individuals to build a full-blown Java add-on as an executable script.

There we suggest to the companies and developers the External Hooks Add-on for Atlassian Bitbucket, to simplify the development process and exclude adverse effects of working with code and repositories.

External Hooks

The External Hooks is add-on for Atlassian Bitbucket.
The add-on provides developers with possibility to eliminate code-related errors during development life-cycle. And as a main function lets developers to implement bash script with git commands, linters or required patterns for analyzing the code. For writing the hooks developers can use any language they are most comfortable with.

There are three types of hooks that the add-on supports:

Pre-receive Hook: runs when the developer is pushing commit in the repository, merging pull requests or applying received commits to the codebase. For example, the developer can create a pre-receive hook to check if all commits contain valid Jira ticket numbers. In that case, the developer needs to specify a valid ticket number for Atlassian JIRA installation.

Post-receive Hook: runs after the entire process is completed. Can be used to update the external services or send notifications to a chat or integration servers.

Merge Check Hook: runs when the developer open pull-request in the repository.

Therefore, the add-on can be utilized in many cases:

  • before pushing to a repository (in sync mode)
  • after pushing to a repository (in async mode)
  • on opening a page for a specific pull-request (one time per set of commits)
  • on pressing the Merge button


  • use any binary script, executable script or shell script as a hook
  • use any arbitrary git command to execute the script, by specifying the command in the configuration of a repository directory
  • create a mirror hook to any other git repository which means publish code to open-source but keep its development inside your company’s repository

Next step

Visit the Installation Guide to obtain the installation instructions for the External Hooks add-on.