Deploying the receive hook for Gitweb

Registering your Gitweb project with the Git adapter allows users to add links from Git commits to Rational Team Concert™ work items from Gitweb. Users add links with the Add Link option that is provided on the Rational® Adapter for Git banner. To add links to work items automatically when users push changes to the shared Git repository, you must deploy the Rational Adapter for Git receive hook.

Before you begin

The Git adapter receive hook requires the Perl 5.10.1 software and these Perl modules:
Important: Some Linux distributions do not include some Perl core modules in their default Perl installation. You must install the full Perl core. The Git adapter receive hook depends on the Time packages and the Crypt package. Although these packages are not included by default in the RHEL 6 distribution, you can add them using these commands.
yum install perl-Time-*
yum install perl-Crypt-SSLeay

About this task

You use the receive hook for Gitweb to process commits pushed to the shared Git repository and associate these commits to existing Rational Team Concert work items.

A script gitweb_setup.sh is provided to help you install and configure the receive hook. You must set the information about how to connect to the Git adapter with either the script gitweb_setup.sh or with git config.

The receive hook for Gitweb is pre-receive.

Important: In adapter software 1.1 or earlier the ./rlia folder was named ./static folder in the Gitweb server directory.

Procedure

  1. To install the Git receive hook, from the ./rlia folder that is found in the root of the Gitweb server directory, run gitweb_setup.sh with the --hook command.

    The --hook command requires the additional parameter --hooks_dir, which you must set to the hooks folder location in the Git repository that you want to add the receive hook to. The --hook command takes four optional parameters. These parameters are --username, --password, --jts_url, and --adapter_project_url. For more information about these parameters, run gitweb_setup.sh --help in the ./rlia folder of the Gitweb server directory.

    Tip: You can run the gitweb_setup.sh script without defining a command and its parameters. The gitweb_setup.sh script when first run, prompts you for the command, either -i to deploy the Gitweb additions, -r to register the Gitweb server, or --hook to deploy the receive hook for Gitweb.

    Run one of these commands:

    ./rlia/gitweb_setup.sh --hook  
    ./rlia/gitweb_setup.sh --hook --hooks_dir /git/repos/my_project/hooks --username clmuser --password clmuserpassword --jts_url https://my.server.com:9443/jts --adapter_project_url https://my.server.com:9443/gitAdapter/adapted-project/0_1/my_project
  2. If you did not set the information about how to connect to the Git adapter with gitweb_setup.sh, you can set rtc.user, rtc.password, rtc.jtsURL, and rtc.AdaptedProjectURL in the Git configuration.
    Important:
    • The user ID, password, and JTS URL can be in a Git configuration level that is shared across several repositories. However, the Git project URI must be configured uniquely for each Git repository. The adapted project URI is the URI you were given when you registered the project from Gitweb.
    • Review the information about the Git adapter receive hook user, see Adapter users.

    Set the following Git config parameters for the specific repository under a Gitweb server. From the command line, go to the shared repository and type the following commands:

    git config rtc.AdaptedProjectURL https://your-host:port/gitAdapter/adapted-project/1/0_2/first.git 
    git config rtc.jtsURL https://your-host:port/jts 
    git config rtc.user username 
    git config rtc.password password 

What to do next

Hide the Git adapter banner for unregistered projects, see Hiding the Git adapter banner on unregistered projects (optional).

Feedback