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.

Procedure

  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.
  5. Uncomment and set the following mandatory variable:
    Variable Description
    RTC_GIT_SERVER_TOOLKIT_PATH Absolute path to the folder where the EWM Git Integration Toolkit has been installed.
    You can also uncomment and set the following optional variables:
    Variable Description
    NODE_EXECUTABLE

    Optional: Absolute path to the node executable. Required if node executable cannot be found in the system path.

    Uncomment and set the trace level if required. Trace messages are written to standard output. The git client will receive these messages.

    RTC_GIT_SERVER_TRACE_LEVEL Optional: 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.
  6. Set the Git configuration properties user.name and user.email for the operating system user who owns the Bitbucket process. By default, this operating system user ID is atlbitbucket.