Deploying the Git receive hook

Each project you registered when you deployed additions to Gitweb has a shared Git repository. If you want developers to be able to add work item references to commit messages and have links created automatically when they push to this shared repository from the command line, you must deploy this hook.

Before you begin

Command line support requires the following software

About this task

You use the Git receive hook to process command line commits and associate these commits to existing Rational Team Concert™ work items.

Perform these steps to install and configure the Git receive hook.

Procedure

  1. Install the receive hook.
    1. Go to the folder location where you installed Rational® Adapter for Git.

      For example, JazzTeamServerDir/server/conf/gitAdapter

    2. Find the gitHook-yyyymmdd-hhmm.zip file.
    3. Create a folder for the zip file in your shared Git repository.

      For example, GitHomeDirectory/hooks

    4. Uncompress the gitHook-yyyymmdd-hhmm.zip file to that hooks folder.

      For example, GitHomeDirectory/hooks

    5. All users who push to this repository must have execute permission for the pre-receive file and the reprocess.pl file. From the command line change to the location of your hooks folder, and type the following command.
      chmod a+x pre-receive reprocess.pl
  2. Configure the receive hook
    Modify the Git configuration to include information about how to connect to Rational Team Concert.
    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.
    • The Git receive hook user can be the same as the functional user that you set up when you created the friend relationship between the adapter and Rational Team Concert. That user that is assigned for this server to server communication does not need read access to the work items it is linking to, but requires at a minimum JazzUsers repository permissions to the repository to read and write work items in the Change and Configuration Management project areas that are used as part of the integration. This user ID is used to log in to the Jazz Team Server and to create the adapted Git resource in the Git adapter database when the request comes from the Git pre-receive created hook. You can create another Git receive hook user but this user also requires JazzUsers repository permissions to create and update work items in Rational Team Concert from the adapter. As well this user does not need a Rational Team Concert-Stakeholder Client Access License, if you are using that method of licensing for the adapter
    1. Set the following Git config parameters for the specific repository under a Gitweb server. All of the parameters can be global except rtc.AdaptedProjectURL. From the command line, navigate to the shared repository and type the following commands.
      Important: The Git receive hook user can be the same as the functional user that you set up when you created the friend relationship between the adapter and RTC. That user was assigned for this server to server communication and had appropriate permissions to create and update work items in RTC. You can create another Git receive hook user but this user must also have appropriate permissions to create and update work items in RTC from the adapter.
      git config rtc.AdaptedProjectURL https://YourGitwebServerURL:port/gitAdapter/YourAdaptedProjectURL 
      git config rtc.jtsURL https://YourGitwebServerURL:port/YourJazzTeamServerURL 
      git config rtc.user username 
      git config rtc.password password 

What to do next

Use the Rational Adapter for Git, see Using the Git adapter.

Feedback