©2017 by Michael Duquette. Proudly created with

  • Michael Duquette

Moving from Gitlab to Github

Updated: Sep 30, 2019

Let’s face it, there is no one perfect platform for hosting repositories. This isn’t a debate about whether Github is better than Gitlab. They both have their pluses and minuses. Recently, we had to move a repository from Gitlab to Github. Without using a migration utility we were able to successfully migrate by following a few steps which I will outline below.

This is the approach that we utilized and worked for us using these tools:

· Gitbash (

· Notepad++ (

At a high level the steps we followed are (*Note* this a high level overview see the steps below for the details):

· Fork and Clone from Gitlab

· Move, find and replace all pointers at the file system level

· Create an empty repository on Github

· Fork and clone the empty repository from Github into a new folder

· Copy all the Gitlab project folder to the Github project folder

· Push to the Github repository

Read the below steps a couple of times. DO NOT just skim them (something I am guilty of doing frequently) but read through them and make sure to pay attention to the NOTES.


To demonstrate the steps taken I’ve created two folders GitLab and GitHub. We’ll start by working in the Gitlab folder first.

From your Gitlab dashboard fork and clone the repository into the local GitLab folder.

Navigate to the GitLab repository folder locally. The goal here is to go folder by folder and using Notepad++ replace all instances of gitlab with github. Take your time and do each folder individually.

Not every file will have a reference to gitlab in it but Notepad++ has a handy replace all feature that will make this short work.

As you are traversing the folders rename any folders that are named gitlab to github as well. Once you finish renaming everything open git-bash in the gitlab folder

and copy everything to your github folder:

CP is the bash copy command

-avr translates to

-a = preserve attributes, file modes, ownership, timestamps…

-v = verbose output

-r = copy directories recursively

On Github create a new empty repository. Open a new git-bash window from the new github repository folder you copied everything into. To retain your Git history follow the instructions from Github to push an existing repository from the command line (make sure you are in the github repository folder) :

NOTE: If you get this error: fatal: remote origin already exists

Do not proceed with the git push.

Run this from you git-bash session: git remote rm origin

If you don’t receive any additional errors re-run the git remote add origin followed by the git push.

At this point you have moved your repository to Github. Verify your app is working correctly and if you are getting any errors go back and double check to make sure you changed all the references from gitlab to github everywhere including folder names.

#CS@Worcester #CS448