Skip to content
Advertisement

Copy Gitlab repositories to another Gitlab server through filesystem

I had a gitlab server of 7.6.2 version with some repositories. Now this server was upgraded by newest Ubuntu and it has an empty gitlab server of version 12.0.1. I also have a HDD backup from old gitlab server.

I need to move all repositories from old gitlab server to the new one. I tried to copy .git repositories from /var/opt/gitlab/repositories/user/ to the similar location of the new server with disabled hashed repositories storage, but it has no effect.

I also tried to create an empty repository with e.g. name test and replace test.git directory on new server from directory from old one, but there is no effect neither.

I tried to find file from created test repository named test.txt by find command in whole server file system, but there is no such file was found (but this file exists in the gitlab repository).

My question is: where repositories of gitlab server are stored and how can I copy it from backup of old server HDD to the new server file system (I can not run both instances of gitlab because I have only one machine. Running backup of old server as virtual machine’s rootfs is also impossible by some reasons).

Upd. It is not duplicate of this question because I have no backups of old gitlab server made by gitlab, I have only backup of filesystem of machine it was installed on. I also can not run old server to pull repositories because its machine was upgraded. Only thing I have from old server: its filesystem.

Advertisement

Answer

If you just need to migrate repositories (ie: no issues, pipelines, etc), it’s better to clone each repository and upload it again (one by one, or using a batch command):

cd /var/opt/gitlab/repositories/...
git remote add newserver url
git push --all newserver url

Instead, if you need to migrate all features, it’s better to restore the server backup and upgrade OS and Gitlab in place… even if it’s a long road between 7 and 12, and you probably neeed to make multiple steps.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement