> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qodo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Install Qodo on Gerrit (on-premises)

> Install and configure the Gerrit integration for Qodo on-premises deployments.

Gerrit is a self-hosted, web-based code review tool for Git repositories where review is organized around changes (individual patch sets) rather than pull requests, and repositories are called projects.

This guide helps you connect Qodo to your Gerrit instance so it can review changes and deliver findings directly where you already work.

Assuming your Qodo environment is already set up, connecting Gerrit involves creating a dedicated Qodo user in Gerrit, connecting it to Qodo, and registering a webhook so Gerrit can notify Qodo of new changes.

## Prerequisites

Before you begin, ensure you have:

* A Qodo on-premises environment already set up. Contact your Qodo Account Manager if you haven't configured this yet.
* A Gerrit instance where you have administrator access, to create a dedicated user, grant it permissions, and register a webhook.

## Access the Gerrit integration

<Steps>
  <Step>
    Log in to your Qodo portal.
  </Step>

  <Step>
    From the left-hand navigation menu, select **Integrations**.
  </Step>

  <Step>
    Select the **Self-Hosted** tab, locate the **Gerrit** card, and click **Add installation** to launch the installation wizard.
  </Step>
</Steps>

## Install Qodo on Gerrit

<Steps>
  <Step title="Before you begin">
    <Frame>
      <img src="https://mintcdn.com/qodo/g6dZYISWI1ljlXbt/images/on-prem/gerrit-wizard-step-1-create-user.png?fit=max&auto=format&n=g6dZYISWI1ljlXbt&q=85&s=35d6b7de84fab8f571312557f63648a5" alt="Gerrit wizard step 1, Create a Qodo user, showing required ref and label permission tables" width="1002" height="783" data-path="images/on-prem/gerrit-wizard-step-1-create-user.png" />
    </Frame>

    <Steps>
      <Step>
        In your Gerrit server, create a new user named `Qodo`. This user will be used to post review comments on Qodo’s behalf in the Gerrit UI.
      </Step>

      <Step>
        Grant the user the following permissions:

        | Ref pattern      | Purpose                                                                |
        | ---------------- | ---------------------------------------------------------------------- |
        | `refs/changes/*` | Access patchset commits for code review and analysis                   |
        | `refs/heads/*`   | Read branch content, including the `.pr_agent.toml` configuration file |
        | `refs/tags/*`    | Read tags for version context in PR descriptions                       |

        | Label           | Range  | Purpose                             |
        | --------------- | ------ | ----------------------------------- |
        | **Code-Review** | -2..+2 | Post review comments and findings   |
        | **Verified**    | -1..+1 | Mark verification status (optional) |
      </Step>

      <Step>
        Generate an HTTP password for the user. You'll enter its username and password in the next step.
      </Step>

      <Step>
        Back in the wizard, click **Continue**.
      </Step>
    </Steps>
  </Step>

  <Step title="Connect to Gerrit">
    <Frame>
      <img src="https://mintcdn.com/qodo/g6dZYISWI1ljlXbt/images/on-prem/gerrit-wizard-step-2-connect.png?fit=max&auto=format&n=g6dZYISWI1ljlXbt&q=85&s=6caedbfcb8bf24ad7b38aefbe7663d8d" alt="Gerrit wizard step 2, Connect to Gerrit, showing Gerrit URL, username, HTTP token, and API path fields" width="1416" height="1111" data-path="images/on-prem/gerrit-wizard-step-2-connect.png" />
    </Frame>

    Enter the following, then click **Connect to Gerrit**:

    * **Gerrit URL**: Your Gerrit instance URL (for example, `https://gerrit.example.com`).
    * **Username**: The dedicated Gerrit user created in the previous step.
    * **HTTP token**: The user's HTTP password.
    * **API path** (optional): Path to Gerrit's authenticated REST API. If your Gerrit instance is served under a sub-path, add that to the Gerrit URL above instead of this field.

    <Note>
      Qodo validates the credentials against your Gerrit server, then stores them in your on-premises database, not in the Qodo portal itself.
    </Note>
  </Step>

  <Step title="Import repositories">
    <Frame>
      <img src="https://mintcdn.com/qodo/g6dZYISWI1ljlXbt/images/on-prem/gerrit-wizard-step-3-import-repositories.png?fit=max&auto=format&n=g6dZYISWI1ljlXbt&q=85&s=f17f1ee15b0cc96a08b3465e877fbd02" alt="Gerrit wizard step 3, Import repositories, showing the repositories-added confirmation and webhook setup commands" width="1401" height="1123" data-path="images/on-prem/gerrit-wizard-step-3-import-repositories.png" />
    </Frame>

    Qodo imports every Gerrit project the connected user can access.

    Then, register a webhook on your Gerrit server so Qodo receives change events:

    <Steps>
      <Step>
        Copy the **Webhook URL** shown in the wizard.
      </Step>

      <Step>
        Run the following command against your Gerrit server, replacing the URL and credentials with your own:

        ```bash theme={null}
        curl --location --request PUT \
          '<gerrit-url>/a/config/server/webhooks~projects/All-Projects/remotes/qodo' \
          --header 'Content-Type: application/json; charset=UTF-8' \
          --user '<username>:<http-password>' \
          --data-raw '{"url":"<webhook-url-from-the-wizard>","events":["patchset-created","comment-added","wip-state-changed","change-merged","change-abandoned"],"maxTries":"3","sslVerify":"true"}'
        ```

        <Note>
          This targets **All-Projects**, Gerrit's global config project. Webhook configuration [is inheritable](https://gerrit.googlesource.com/plugins/webhooks/+doc/master/src/main/resources/Documentation/config.md): it applies to every repository, without requiring per-project configuration. To scope the webhook to specific repositories, replace `All-Projects` in the URL with a repository's name and repeat this for each repository to include.
        </Note>
      </Step>

      <Step>
        Verify it was created:

        ```bash theme={null}
        curl --user '<username>:<http-password>' '<gerrit-url>/a/config/server/webhooks~projects/All-Projects/remotes'
        ```

        Replace `All-Projects` with a specific repository name if that's what you registered the webhook against.
      </Step>

      <Step>
        Back in the wizard, click **Done**.
      </Step>
    </Steps>
  </Step>
</Steps>

## Verify the installation

<Steps>
  <Step>
    Open a new change in one of the connected projects and confirm that Qodo is triggered automatically.
  </Step>

  <Step>
    Add a comment using one of the supported commands:

    * `/agentic_describe`
    * `/agentic_review`

    Qodo should respond with a review or change summary directly on the change.
  </Step>
</Steps>

## Troubleshooting

If Qodo is not responding:

* Confirm the webhook is registered on the project you expect (`All-Projects`, or a specific repository), using the verify command from [Install Qodo on Gerrit](#install-qodo-on-gerrit).
* Confirm the HTTP credential used hasn't expired.

## Manage repositories

Every Gerrit project the connected user can access is imported when you connect (see [Install Qodo on Gerrit](#install-qodo-on-gerrit)), but only projects covered by the webhook actually receive change events.

* To cover only specific projects, register the webhook against those projects by name instead of `All-Projects`.
* To turn code review on or off for a project already covered by the webhook, without touching the webhook itself, use the **Code review** toggle on the [Repositories page](/governance/repositories) in the Qodo portal.

## Next steps

* [Using Qodo in code reviews](/code-review/use-qodo-in-prs): Get the most out of Qodo.
* [Install and configure Qodo](/install-and-configure/configuration-overview): Use the shared configuration guides to configure Qodo for your organization.
