Get Started

SubGit Plugin for Gerrit

INFORMATION
Gerrit does not trigger standard pre-receive and post-receive hooks when one pushes new commits to Git repository. SubGit heavily relies on those hooks in order to maintain reliable two-way mirror. On this page you can download SubGit plugin for Gerrit that emulates pre-receive hook behavior.

1. Download SubGit Plugin for Gerrit

For Gerrit v3.3 and later:

Version: 1.2.1, published on: August 3, 2021

subgit-gerrit-plugin-1.2.1.jar

MD5 checksum: fa62f041792a460fedd8442efcadfc24

For Gerrit v3.0-3.2:

Version: 1.1.0-EAP1, published on: July 21, 2021

subgit-gerrit-plugin-1.1.0-EAP1.jar

MD5 checksum: 923565088b4f43095c2d00d78907e506

2. Install SubGit Plugin into Gerrit

Move downloaded file into GERRIT_SITE/plugins/ directory and make sure the plugin becomes enabled at Plugins | Installed:

List installed plugins

If you have older version of the plugin, replace it with the newer one. We recommend to restart Gerrit after upgrading previously installed version of the plugin.

3. Increase receive timeout

Set receive.timeout to 0 in GERRIT_SITE/etc/gerrit.config file and then restart Gerrit server:

$ git config -f GERRIT_SITE/etc/gerrit.config receive.timeout 0
$ GERRIT_SITE/bin/gerrit.sh restart

By default Gerrit may interrupt git push operation on timeout, setting receive.timeout to 0 forces Gerrit to wait until SubGit completes Git-SVN synchronization.

4. Create empty Git repository

Create empty Git repository at Projects | Create New Project:

Create empty Git repository

5. Follow standard instructions

Locate repository directory of created Gerrit project:

$ ls GERRIT_SITE/git/
$ ls GERRIT_SITE/git/project.git

and follow standard instructions on establishing Git-SVN mirror with SubGit command line tool:

Run the following command to configure Git repository to mirror SVN project:

$ subgit configure --layout auto SVN_URL GERRIT_SITE/git/project.git

Above command will detect branches layout in the SVN project and generate SubGit configuration file ready for further adjustments. You may be asked for credentials unless those are already stored in the SVN credentials cache at ~/.subversion/ directory.

Review and adjust branches mapping configuration:

$ edit GERRIT_SITE/git/project.git/subgit/config

Review and adjust Git/SVN authors mapping:

$ edit GERRIT_SITE/git/project.git/subgit/authors.txt

You may use dynamic authors mapping replacing authors.txt with a script. Script sample could be found at GERRIT_SITE/git/project.git/subgit/samples/ directory.

Run the following command to enable mirror and translate SVN revisions to Git commits:

$ subgit install GERRIT_SITE/git/project.git

As soon as initial translation is completed, Gerrit project is ready to serve users. Commits pushed to this project will be translated to Subversion repository and SVN revisions will be translated to Git.

6. Get Support

Would you have any question on using SubGit with Gerrit, don’t hesitate to contact us at support@subgit.com. We’d be glad to assist you.

Contact us

Please fill out all fields.


By clicking on this button you agree to provide us your personal data for the purpose of technical support for you. Please read our Privacy policy for more details.

Thank you for contacting us!
We will get back to you soon.

Check out our Support Forum! The answer to your question might already be there.

We are sorry, something went wrong. Please try again or contact us.