1

we are migrating from Gerrit Code Review to GitLab in our office. I know how to clone one repository from Gerrit to GitLab. But in our office server we have around 50 or so repositories. I have tried transferring the repositories manually to GitLab's 'repositories' directory and then importing, but it only creates bare repositories. I'd like to know if there's a way to clone all the repositories in one go. Please help...

redmoses
  • 75
  • 3
  • 8

1 Answers1

1

but it only creates bare repositories

That is what GitLab manages, as a Git Hosting service: bare repos that you can clone locally.

You could move those non-bare repo by:

  • moving only the .git of your existing repo to GitLab repo folder, where each .git is renamed after the repo it was in:

    repo1/.git => /home/git/repositories/repo1.git
    repo2/.git => /home/git/repositories/repo2.git
    repo2/.git => /home/git/repositories/repo3.git
    

If you are talking about two different servers (hopefully both with the same OS), I would recommend tar cpvf repo1.git.tar /tmp/repo1.git: move in /tmp and rename first, then tar, and copy over that tar to the new server.


While the import process command is correct, the OP redmoses mentions in the comments:

If I just copy the repositories to /home/git/repositories, then the repositories appear in GitLab with no source files or no record of previous commits done in Gerrit.

To make this work this is what I did:

  • Created a new directory inside the repositories directory
  • Copied all the repos from Gerrit (was located in /usr/local/gerrit2/git) to the new directory.
  • Then just simply ran GitLab's import process GitLab then created a group called "Dev" and imported the existing repositories perfectly.

And I didn't need to convert the repositories to bare.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • If I just copy the repositories to /home/git/repositories then the repositories appear in GitLab with no source files or no record of previous commits done in Gerrit. To make this work this is what I did - - Created a new directory inside the repositories directory - Copied all the repos from Gerrit (was located in /usr/local/gerrit2/git) to the new directory. - Then just simply ran GitLab's import process GitLab then created a group called "Dev" and imported the existing repositories perfectly. And I didn't need to convert the repositories to bare. Thanks anyways – redmoses Jan 02 '14 at 14:03
  • @redmoses Sounds great. I have included your comment in the answer for more visibility. – VonC Jan 02 '14 at 15:29