Import repository from git to gerrit

两盒软妹~` 提交于 2019-11-29 23:58:13

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.

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.

  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.

Additional information...

So you can copy the git repository straight across into the gerrit data location and it will show up after a restart ( or flush of cache ( reindex )).

BUT you will be missing the important configuration from your repository, which may prevent ability to push, create branches, review etc.

If you view the repo you will see it is missing the 'refs/meta/config' branch. So in an normal system without changes this will inherit from All-Projects, but this could be any Project on your configuration.

Steps to fix configuration:

  1. List item
  2. Copy git repo
  3. Refresh cache / restart gerrit / reindex
  4. Open repo from project list view
  5. Click on branches
  6. Type in the new branch name of "refs/meta/config" at revision "HEAD"
  7. Click "edit config" from the project general view.
  8. This creates a file (project.config) in this branch for configuration. Add some default configuration, either taken from a working repo, or as follows:

e.g.

[access]
   inheritFrom = All-Projects
  1. Click Save, then CLOSE.
  2. Click Review ( to give it +2)
  3. Click Publish Edit to save this change into gerrit.

You can now use the repository with sensible inherited configuration the same as your other projects.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!