Import repository from git to gerrit

I imported many GIT projects to gerrit, the easiest way I found was to copy the xy.git Directory of the git repository to the directory where gerrit deposits the git repos. After restart of gerrit process the new project is in the list of new projects and you can edit description and access rights.


First of all: There is no special "Gerrit format". Gerrit works with regular git repositories.

  1. Create a new project in Gerrit (without an initial commit). Add the created repository as a remote to your existing repository and simply push. You can configure Gerrit to allow direct pushing into the repository (bypassing review), allowing you to import the entire repository.

    Alternatively, if you have direct access to Gerrit's repository location (e.g. via SSH or on the local filesystem), you can just push directly into the repository (whereever Gerrit created it), bypassing Gerrit entirely. You'll need to flush the Gerrit caches afterwards, however, for Gerrit to notice that the repository HEADs have updated.

  2. As said, there is no "Gerrit format". Just clone your repository from gerrit, and all is well. You don't need to worry about any special branches.


  1. Just create the new project in Gerrit, and then push the git repository there. If you want to bypass review, push directly to master instead of refs/for/master. You'll need to add the permission to do this to yourself.

    I think the error message may be caused by you not having imported your ssh key to Gerrit yet.

  2. Just clone the repository from Gerrit. It won't include any extra branches.

Tags:

Git

Gerrit