Import repository from git to gerrit

后端 未结 4 1688
日久生厌
日久生厌 2021-02-01 03:57

I have two questions about Gerrit:

  1. How do I convert or import an already existing Git repository into Gerrit\'s format? There were a lot of com

相关标签:
4条回答
  • 2021-02-01 04:02

    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.

    0 讨论(0)
  • 2021-02-01 04:08
    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.

    0 讨论(0)
  • 2021-02-01 04:16

    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.

    0 讨论(0)
  • 2021-02-01 04:24

    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.

    0 讨论(0)
提交回复
热议问题