Friday, November 7, 2014

How to Export/Import a GitLab Project

Important note: Please make sure you have a backup. I'm not a git expert and I have only tried this once
1- Clone the project
$ git clone http://[user]:[password]@[server]/[namespace]/[project].git
2- cd into the new created directory and create a bundle
$ git bundle create [project].bundle --all
3- Create a new project on the new server UI
4- Clone the new empty project
$ git clone http://[user]:[password]@[server]/[namespace]/[project].git
Initialized empty Git repository in /home/mendonca_v/Git/[project]/.git/
warning: You appear to have cloned an empty repository.
5- Change into that new project
$ cd [project]
6- Pull the bundle into that project
$ git pull ../common-impl/common-impl.bundle master
Note: When you do 'git status' no changes will be shown
$ git status
# On branch master
nothing to commit (working directory clean)
7- Push the contents to the new server
$ git push -u origin master

No comments: