Skip to content

Commit 250ad2a

Browse files
authored
Update Gerrit docs to remove admin requirement and SSH limitation (#961)
Gerrit does not require admin credentials, only credentials of a user that can access the required repositories. Gerrit connections also support cloning via SSH using `gitSSHCredential` like other code hosts.
1 parent 6c7f996 commit 250ad2a

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

docs/admin/code_hosts/gerrit.mdx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ A Gerrit instance can be connected to Sourcegraph as follows:
2121
```json
2222
{
2323
"url": "https://gerrit.example.com/", // Be sure to add a trailing slash
24-
"username": "<admin username>",
25-
"password": "<admin password>",
24+
"username": "<username>",
25+
"password": "<password>",
2626
"projects": [ // If not set, all projects on the Gerrit instance will be mirrored
2727
"docs",
2828
"kubernetes/kubernetes"
@@ -33,15 +33,34 @@ A Gerrit instance can be connected to Sourcegraph as follows:
3333
"authorization": {} // Marks all repositories as private. Users will be required to present valid Gerrit HTTP credentials in order to view repositories
3434
}
3535
```
36-
4. The provided `username` and `password` must be the HTTP credentials of an admin account on Gerrit. See [the Gerrit HTTP documentation](https://gerrit-documentation.storage.googleapis.com/Documentation/2.14.2/user-upload.html#http) for details on how to generate HTTP credentials.
37-
<Callout type="note">The Gerrit instance has to have HTTPS clones enabled (the default). [`download.scheme=http`](https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#download). Sourcegraph cannot clone Gerrit repos via SSH.</Callout>
36+
4. The provided `username` and `password` must be the HTTP credentials of an account on Gerrit that has access to all the repositories that need to be cloned. See [the Gerrit HTTP documentation](https://gerrit-documentation.storage.googleapis.com/Documentation/2.14.2/user-upload.html#http) for details on how to generate HTTP credentials.
3837
5. Select **Add Repositories** to create the connection. Sourcegraph will start mirroring the specified projects.
3938

4039
If you added the `"authorization": {}` option to the configuration, and this is the first Gerrit code host connection you have created for this Gerrit instance, you might see a warning like this:
4140
![Warning indicating that an authentication provider is required for a code host connection](https://storage.googleapis.com/sourcegraph-assets/docs/images/administration/config/external-services/gerrit/gerrit-auth-warning.png)
4241

4342
Simply follow the steps in the next section to configure a Gerrit authentication provider.
4443

44+
### Clone using SSH
45+
46+
To clone using SSH, provide `"gitSSHCredential"` in the configuration:
47+
48+
```json
49+
{
50+
"url": "https://gerrit.example.com/",
51+
"username": "<username>",
52+
"password": "<password>",
53+
"projects": [
54+
"docs",
55+
"kubernetes/kubernetes"
56+
],
57+
"gitSSHCredential": {
58+
"privateKey": "..." // base64 encoded private key that will be used for cloning
59+
},
60+
"authorization": {}
61+
}
62+
```
63+
4564
## Add Gerrit as an authentication provider
4665

4766
If the `"authorization": {}` option has been set on a Gerrit code host connection, a Gerrit authentication provider will be required so that authroized users are able to search for and browse the code mirrored by that code host connection.

0 commit comments

Comments
 (0)