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...
1 Answers
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 - .gitof your existing repo to GitLab repo folder, where each- .gitis 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.
- transform those repos into bare one: - cd /tmp/repo1.git && git config --bool core.bare true
- Try the Import process of GitLab (but there seems to be a bug in progress on that: issue/pull 5005 - bundle exec rake gitlab:import:repos RAILS_ENV=production 
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.
- 
                    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
 
     
    