Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gerrit integration roadmap #871

sqs opened this Issue Nov 7, 2018 · 1 comment


None yet
3 participants
Copy link

sqs commented Nov 7, 2018

This issue captures the work (which spans multiple releases) to improve Sourcegraph's integration with Gerrit.

  • Browser extension support #2898

Customers using Gerrit (not exhaustive):

@sqs sqs added the feature-request label Nov 7, 2018

@sqs sqs added this to the Backlog milestone Nov 7, 2018

@sqs sqs added the repo-updater label Nov 7, 2018


This comment has been minimized.

Copy link

tsuna commented Feb 26, 2019

In case anyone lands here like me after Googling for "Sourcegraph Gerrit", here is what I wound up doing to make it work.

First of all, do not try to mount Gerrit's bare repos into Sourcegraph's container, that won't work as Sourcegraph expects a different layout on the filesystem and will actively move things around in a way that breaks Gerrit (and since it runs as root, it can).

First create an SSH key pair for Sourcegraph to access Gerrit (note: I personally use /etc/sourcegraph instead of ~/.sourcegraph because I don't want the daemon's config to be in my home directory, not sure why that's the default recommendation in the docs, but I'll just stick with that here even though that's against best practices):

mkdir ~/.sourcegraph/config/ssh
chmod 700 ~/.sourcegraph/config/ssh
ssh-keygen -f ~/.sourcegraph/config/ssh/id_rsa
<hit enter for no password>

Then create an account on Gerrit for Sourcegraph (using the public key from ~/.sourcegraph/config/ssh/

ssh -p <gerrit-port> "gerrit create-account --email --full-name Sourcegraph --ssh-key 'ssh-rsa <public-key-here> sourcegraph@localhost' sourcegraph"
ssh -p <gerrit-port> "gerrit set-members -a sourcegraph 'Non-Interactive Users'"

Check that the account has been created properly:

ssh -i ~/.sourcegraph/config/ssh/id_rsa -o UserKnownHostsFile=$HOME/.sourcegraph/config/ssh/known_hosts -p <gerrit-port>

This should print a **** Welcome to Gerrit Code Review **** banner if things worked properly. Also as a side-effect of running that command, the known_hosts file be created and seeded properly.

Then need to create a bit of SSH config in order for Sourcegraph to use the correct user when SSH'ing into Gerrit (otherwise it'll attempt to log in as root):

cat >~/.sourcegraph/config/ssh/config <<EOF
  User sourcegraph
chmod 600 ~/.sourcegraph/config/ssh/config

After having done this, you can docker run the Sourcegraph container and then in the site-admin external services, configure an external repo of kind "other" with this config:

  "url": "ssh://<gerrit-port>",
  "repos": ["myrepo"]

@sqs sqs changed the title Support Gerrit Gerrit integration roadmap Mar 22, 2019

@sqs sqs added the roadmap label Mar 22, 2019

@sqs sqs self-assigned this Mar 22, 2019

@tsenart tsenart removed the repos label Apr 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.