Registering Gerrit projects

The Gerrit projects must be registered with the adapter.

Before you begin

The Gerrit server is registered with the adapter.
Restriction: Check that your project name does not contain special characters (such as a blank space or plus sign) other than a forward slash. Other special characters might cause problems when the project is registered or change links are created or traversed. One indication of a problematic name is that it is displayed with double quotation marks in the Git Project Name field of the Register Git Project page after you choose to Register This Project from Gerrit. Rename any projects that contain special characters other than a forward slash before you register the project.

About this task

You register a Gerrit project with the adapter. You must be logged in as a Rational Team Concert™ user with administrator or project administrator privileges. Repeat this procedure for each project you want to register.

Procedure

  1. Point your web browser to the Gerrit home page. For example, http://our.gerrit.server/gerrit

    The Rational® Adapter for Git banner shows. The banner is one of the Gerrit additions that you deployed to the Gerrit server.

  2. From the Gerrit home page, go to a list of changes for a project that you want to register.
  3. Click the Admin (Administration) icon in the upper right portion of the banner and then click Register This Project.

    Register This Project

    The Register Git Project page opens in a new web browser window.

  4. Confirm that the Git Project Name contains the project name that you want to register.
  5. Optional: Add a summary.
  6. Associate the project with a Rational Team Concert project.
    1. Click Add.
    2. In the Associate Rational Team Concert Projects window, select the check box next to the Rational Team Concert project or projects that you want to associate this Gerrit project with.

      Associate Rational Team Concert projects with Gerrit project

    3. Click Associate Projects.
  7. Click Register.
  8. The Gerrit project is registered with the adapter. Further instructions direct you to configure the hooks that automate the creation of links when commits are pushed to the registered Gerrit project. Note the registered Gerrit project URL. The registered Gerrit project URL is required to install and configure the receive hook for the project.
  9. Configure the receive hook for your registered project.
    1. Click Receive Hook
    2. Add change request tags and separate each one with a comma. For example, bug, task

      The adapter checks for these tags in the commit message to determine whether a link to a work item can be created.

    3. Add branch names and mark them as include or exclude to limit which branches the Git receive hook applies to. You can use the * glob pattern to match zero or more characters in a branch name. The adapter reviews all of the globs, and the last glob to match the branch name applies. For example, if you have a branch named bug180 and include bug1* and then exclude bug18*, the adapter excludes the branch named bug180 because the last glob to match the branch name applies.

    Add receive hook options for a registered Gerrit project

    When a user clicks a link from an Rational Team Concert work item to a Gerrit change, the Git URL Format is used to reconstruct the URL of the Gerrit change and redirect the request. The default value is <server>#/q/<changeid>+project:<project>,n,z

Results

The Gerrit project is registered with the adapter.

What to do next

Configure the Gerrit receive hook for the Gerrit project, see Deploying the receive hook for Gerrit.

Feedback