Deploying post-receive hooks in a Git repository managed by Bitbucket

You can configure post-receive hooks for linking work items to Git commits.

About this task

On Linux, the Git repositories are located by default under /var/atlassian/application-data/Bitbucket/shared/data/repositories. The following steps assume that the Git repositories are in this location. Repeat this task for each Git repository.

To find the Git repository in the repositories folder corresponding to a Git repository in the Bitbucket web interface, follow the steps in Identifying a Repository on the Bitbucket Server.


  1. Create a folder named post-receive.d under /var/atlassian/application-data/Bitbucket/shared/data/repositories/repository-ID/hooks.
  2. Copy the post-receive hook file from EWM-git-integration-toolkit-install-folder/server/hooks/examples/bitbucket/post-receive to /var/atlassian/application-data/Bitbucket/shared/data/repositories/repository-ID/hooks/post-receive.d.
  3. Assign executable permission to the file: chmod +x post-receive
  4. Open the post-receive file in a text editor and set the following environment variables:
    Environment variable Description
    NODE_EXECUTABLE Absolute path to the node executable. Required if node executable cannot be found in the system path.
    RTC_GIT_SERVER_TOOLKIT_PATH Absolute path to the folder where the EWM Git Integration Toolkit has been installed.
    RTC_GIT_SERVER_TRACE_LEVEL Logging level for the hooks. Set this value to 4 while you set up the integration. Revert it after you validate the integration.
    REMOTE_USER Optional: If IBM® Engineering Workflow Management (EWM) and Bitbucket do not share a common user base, then provide a functional user ID. This user ID should be a valid EWM user.
  5. Set the Git configuration properties and for the operating system user who owns the Bitbucket process. By default, this operating system user ID is atlbitbucket.