Migration from self hosted plain git to gitlab

Hi All,

We have two git environments.

  1. Self hosted customized git servers
  2. Self hosted gitlab ce servers [ New environment we set up recently ]

Process I know for migrating repositories from a git server to other git server will be by changing the remote URL and push the repo to new git server. Or we could import option on gitlab.

But In our self hosted customized git server, We have now more than 8000 repositories

What would be the best way to migrate these repos from plain git server to our self hosted gitlab ce server.

Is there anyway we can do mass migration or do we need to do it individually for each repo [ this will take more than year to turn off plain git completely]

I appreciate everyone’s feedback . Let me know If you guys know a solution for this

Regards
PRS

1 Like

You can add new gitlab remote to your existing repository and push:

git remote add gitlab http://<gitlab-repo>
git push gitlab master

If you need more assistance feel free to email me: tgefen at almtoolbox dot com

Hi @prash.ds9, You may write a script which loops thru all existing Git projects. For each existing Git project it shall use the GitLab API to create a corresponding GitLab project and import an existing repo to it from your Git server.

See https://docs.gitlab.com/ce/api/projects.html#create-project and in particular, the import_url option.

1 Like

Thanks for response, But this process needs lot of manual work and time. We have more than 8000 repos. I knew about this process but the problem is it will take lot of time to spend on each repo. Let me know If you come across best practice for these type of migrations.

Hi @alexk , Is this process allows us to create groups? We would like to have groups for different working teams and projects inside of groups.

Is something possible with API?

Of course you can create groups using API. See https://docs.gitlab.com/ce/api/groups.html#new-group. You can also create a project in a group, move an existing project to a group and so on.

Thanks @alexk. Can you give me your email address, I will reach out If I need any inputs from you with migration process

alexk@almtoolbox.com