Configuring pre-receive hooks in GitLab

You can configure pre-receive hooks on the GitLab Community or GitLab Enterprise server to enable process enforcement between GitLab and IBM® Engineering Workflow Management (EWM).

About this task

On Linux, the Git repositories are located by default under /var/opt/gitlab/git-data/repositories. The following steps assume that the GitLab repositories are in this location. Repeat this task for each Git repository. If there are existing hook scripts, manually merge the new scripts with the existing ones.


  1. Create a folder named custom_hooks under /var/opt/gitlab/git-data/repositories/repository-name.
  2. Copy the pre-receive hook file from EWM-git-integration-toolkit-install-folder/server/hooks/examples/gitlab/pre-receive to /var/opt/gitlab/git-data/repositories/repository-name/custom_hooks.
  3. Assign executable permission to the file: chmod +x pre-receive
  4. Open the pre-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.
    GL_TOKEN Personal access token of a GitLab user.
    GL_SERVER The URL of the GitLab server.
    VERIFY_GITLAB_SSL_CERT Set the value to true if the GitLab server's certificate should be validated by the hook. Otherwise, set to false. The default is true. This option applies only if the GitLab server is configured with HTTPS.