Posted by: kezhong | June 10, 2016

Migrate projects from the old GitLab servers to the new one

My company wanted me to combine the projects from the old GitLab servers to the new one. There are many ways on the internet, I tried several ways, finally I found this method worked well.

Download projects from the old server, for example:
# git clone –mirror git@gitlab1.example.com:group1/project1.git

Create new projects on the new GitLab server through the website

Modify the config file, change the url to the new one
# cd project1.git/
# vi config
[core]
repositoryformatversion = 0
filemode = true
bare = true
[remote “origin”]
url = git@gitlab2.example.com:group1/project1.git
fetch = +refs/*:refs/*
mirror = true

Upload the project to the new GitLab server
# git push origin –mirror

Reference

Import an existing git project into GitLab?


Leave a comment

Categories