How to migrate from Github to your self-hosted Gitlab

Today Github has announced that it has been acquired by Microsoft. Some of you do not like this move and choose to move over to the hosted version of Gitlab. However, did you know that you can host your own Gitlab installation without investing a lot in managing your own server? In this article we will show you how you can setup your own Gitlab server at Yourwebhoster.eu and how to migrate your Github repositories to Gitlab.

What is Gitlab?

Perhaps better: what is it not? You can run your own Github with a Gitlab sauce on your own virtual private server. You own the data. There is no license fee. And you will get a ton of features. It starts with repository management, goes on with hosting a Docker registry or publishing documentation automatically. Or how about CI or Kubernetes? And best of all; you can also get commercial premium support.

Spin up your VPS

Go to our website and order a new VPS. Navigate to the control panel and install CentOS 7 on your virtual server. Installing is done within a few minutes.

Install Gitlab on CentOS 7

We have setup a knowledge base article to help you out with the basic setup of your Gitlab server. You can find the installation guide Gitlab for CentOS 7 here.

Configure your firewall

As recommended in the article, we do recommend to use CSF. Run the following command to whitelist your IP:

csf -a 123.123.123.123

(replace 123.123.123.123 with your internet IP)

Open /etc/csf/csf.conf and set TESTING to 0 and find TCP_IN (and TCP6_IN). Make sure that it looks like this:

TCP_IN="22,80,443"
TCP6_IN="22,80,443"

Restart CSF:

csf -x && csf -e

Import the repositories

  1. Create a new project by clicking on the + symbol in the menu bar.
  2. Choose to import a project.
  3. Click on Github.
  4. You will need to generate a personal access token with Github. Enter the token.
  5. Click on Import.
  6. Presto! You are done!

Alternatively you can configure Gitlab to integrate with oAuth. This makes importing projects easier. Check out the documentation of Gitlab for more information.

Leave a Reply

Your email address will not be published. Required fields are marked *