Gerrit
Beta
Site admins can sync Git repositories hosted on their private Gerrit instance with Sourcegraph so that users can search and navigate the repositories.
To connect Gerrit to Sourcegraph:
- Go to Site admin > Manage code hosts > Add code host
- Select Gerrit
- Set url to the URL of your Gerrit instance.
- Provide an admin username and password. A password can be generated by following these instructions. Only HTTP/HTTPS credentials are supported.
- Click Add repositories.
{ "url": "https://gerrit.example.com", "username": "<admin username>", "password": "<admin password>", "projects": [ // If not set, all projects on the Gerrit instance will be mirrored "docs", "kubernetes/kubernetes" ] }
Repository permissions
By default, all Sourcegraph users can view all repositories. To configureSourcegraph to use Gerrit's access management, see "Repository permissions".
User authentication
If repository permissions is configured, Gerrit has to be added as an authentication provider.See the authentication documentation.
Configuration
Gerrit connections support the following configuration options, which are specified in the JSON editor in the site admin "Manage code hosts" area.
admin/external_service/gerrit.schema.json
{ // If non-null, enforces Gerrit repository permissions. This requires that there is an item in the [site configuration json](https://docs.sourcegraph.com/admin/config/site_config#auth-providers) `auth.providers` field, of type "gerrit" with the same `url` field as specified in this `GerritConnection`. "authorization": null, // The password associated with the Gerrit username used for authentication. "password": null, // An array of project strings specifying which Gerrit projects to mirror on Sourcegraph. If empty, all projects will be mirrored. "projects": null, // Other example values: // - ["name","owner/name"] // - [ // "docs", // "kubernetes/kubernetes", // "golang/go", // "facebook/react" // ] // URL of a Gerrit instance, such as https://gerrit.example.com. "url": null, // Other example values: // - "https://gerrit.example.com" // A username for authentication withe the Gerrit code host. "username": null }