---
title: "Gerrit"
canonical_url: "https://docs.getdx.com/connectors/gerrit/"
md_url: "https://docs.getdx.com/connectors/gerrit.md"
last_updated: "2026-05-08"
---

# Gerrit
By integrating Gerrit with DX, you can analyze code reviews, changes, projects, and user data. Please refer to the API documentation below and our [schema explorer](https://docs.getdx.com/schema/) to see what data DX imports—note that DX does not read or access your source code.

## Prerequisites

To connect Gerrit to DX, you need:

- a Gerrit user account with appropriate permissions to access the Gerrit REST API
- basic authentication credentials (username and password) for the Gerrit instance
- allowlist [DX IP addresses](https://docs.getdx.com/allowlisting-dx/) if your Gerrit instance is behind a firewall or has IP restrictions

## Setup instructions

Follow the steps below to connect Gerrit to DX.

### Data connection

#### Step 1

Create a Gerrit user account or use an existing account that has the necessary permissions to access:

- Projects
- Groups and group members
- Changes (code reviews)
- User accounts

To get your authentication credentials:

1. Log into your Gerrit instance
2. Navigate to **Profile Settings** (click on your username in the top right corner)
3. Go to **HTTP Credentials** section
4. Your **username** is displayed at the top of this section
5. Click **Generate Password** to create a new HTTP password for API access
6. Copy and save both the username and generated password securely

#### Step 2

- Navigate to the connections page in DX and select "+ Connection" in the top right.
- Enter the credentials you have generated in the previous steps—refer to the information below for errors and troubleshooting.
  - **Gerrit Base URL**: The base URL of your Gerrit instance (e.g., `https://gerrit.example.com`)
  - **Username**: Your Gerrit username
  - **Password**: Your Gerrit password or HTTP password

## API reference

The table below lists the specific API endpoints that are used by DX.


| Endpoint | Documentation |
|--------------------------------------------------------------------------------------------------|---------------|
| /a/projects/ | [Link](https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#list-projects) |
| /a/groups/ | [Link](https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#list-groups) |
| /a/changes/ | [Link](https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes) |
| /a/changes/{change_id}/comments | [Link](https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-change-comments) |
| /a/changes/{change_id}/detail | [Link](https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-change-detail) |
| /a/groups/{group_name}/members/ | [Link](https://gerrit-review.googlesource.com/Documentation/rest-api-groups.html#list-group-members) |
| /a/accounts/ | [Link](https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#query-account) |


## Errors

The table below lists potential error codes when adding a connection in DX.


| Error | Description |
|------------------------|--------------------------------------------------------------------------|
| `invalid_credentials` | Your Gerrit credentials entered are not valid. |
| `invalid_permissions` | Your Gerrit user account does not have the permissions required by DX. |
| `no_resources` | DX cannot access any projects or changes in your Gerrit instance. |


## Curl commands

#### When connection verification fails

When DX verifies a Gerrit connection, it checks access to projects and changes. If your connection is failing, you can test these endpoints directly using the curl commands below to troubleshoot the issue.

<div>
  <p class="mb-4 text-sm text-gray-700">Replace YOUR_GERRIT_URL, YOUR_USERNAME, and YOUR_PASSWORD with your actual values before running these commands.</p>
  
  <div class="mb-4 p-3 bg-gray-50 rounded">
    <p class="font-medium text-sm mb-2">Authentication:</p>
    <p class="text-sm">Use <code>-u YOUR_USERNAME:YOUR_PASSWORD</code> for basic authentication</p>
  </div>

  <h4>1. Test Projects Access</h4>
  <p>This verifies that your credentials can access projects in your Gerrit instance:</p>
  
  <div class="code-block-wrapper">
    <button class="copy-button" title="Copy to clipboard">
      <svg class="copy-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
      <svg class="check-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>
    </button>
    <pre><code class="language-bash">curl -u YOUR_USERNAME:YOUR_PASSWORD -H 'Accept: application/json' 'YOUR_GERRIT_URL/a/projects/'</code></pre>
  </div>

  <h4>2. Test Groups Access</h4>
  <p>This verifies that your credentials can access groups:</p>
  
  <div class="code-block-wrapper">
    <button class="copy-button" title="Copy to clipboard">
      <svg class="copy-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
      <svg class="check-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>
    </button>
    <pre><code class="language-bash">curl -u YOUR_USERNAME:YOUR_PASSWORD -H 'Accept: application/json' 'YOUR_GERRIT_URL/a/groups/'</code></pre>
  </div>

  <h4>3. Test Changes Access</h4>
  <p>This verifies that your credentials can access changes (code reviews):</p>
  
  <div class="code-block-wrapper">
    <button class="copy-button" title="Copy to clipboard">
      <svg class="copy-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
      <svg class="check-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>
    </button>
    <pre><code class="language-bash">curl -u YOUR_USERNAME:YOUR_PASSWORD -H 'Accept: application/json' 'YOUR_GERRIT_URL/a/changes/?q=status:open'</code></pre>
  </div>

  <h4>4. Test Accounts Access</h4>
  <p>This verifies that your credentials can access user account information:</p>
  
  <div class="code-block-wrapper">
    <button class="copy-button" title="Copy to clipboard">
      <svg class="copy-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
      <svg class="check-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>
    </button>
    <pre><code class="language-bash">curl -u YOUR_USERNAME:YOUR_PASSWORD -H 'Accept: application/json' 'YOUR_GERRIT_URL/a/accounts/?q=is:active'</code></pre>
  </div>
</div>

If you receive a 401 Unauthorized error, your credentials are invalid. If you receive a 403 Forbidden error, your user account doesn't have the required permissions. If you receive a 404 Not Found error or empty results, check that your Gerrit base URL is correct and accessible.

**Note about Authentication**: The `-u YOUR_USERNAME:YOUR_PASSWORD` flag uses curl's built-in basic authentication, which automatically handles the Base64 encoding required for Gerrit authentication.
---

## Sitemap

[Overview of all docs pages](/llms.txt)
