先作为主站备份 源站:https://my.toho.red

Easily set up a private code repository with GitLab.


A few years ago, when I first started using GitHub, I learned about the existence of GitLab. In my opinion, GitLab's page design is more to my liking, but due to convenience and financial reasons, I didn't delve into it. However, due to the influence of a certain event, I had to pay attention to the importance of a private code repository again. So I started researching GitLab again.

This article will introduce how to set up GitLab and its configuration methods.

#Getting Started

##Installing GitLab
Since I'm used to using Baota and it's more convenient to install it with just one click in Baota, I won't go into much detail about this part.

QQ 截图 20220529173450.png

Simply search for GitLab in the applications and click "Install" to set it up. There is a big pit here: my host is Tencent Cloud's lightweight machine, with only 2GB of memory, and Baota has two versions, the first one can be installed with 2GB of memory, and the second one requires 4GB of memory. Then the pit comes, 2GB of memory can only install CentOS 6/7 system. Just when I was frustrated that the Baota Tencent Cloud customized version couldn't install the OneDrive plugin, I directly reinstalled the Ubuntu system, but I didn't pay attention to this point and had to reinstall the system again.

After installation, you can get the access address from Baota and simply configure the password to log in with the default username "root".

##Migrating from GitHub

Enter the backend, click on "New Project", and you will see that GitLab has prepared migration options for us:

QQ 截图 20220529174837.png

However, when you think you can use it by clicking on it, a popup window suddenly appears:

QQ 截图 20220529175052.png

What's going on here? Only by looking through the official documentation did I realize that one-click import is a considerate feature only available on the GitLab official website, and the self-hosted version requires some preparation. Since the configuration process is too cumbersome, you can simply choose to import from URL.

QQ 截图 20220529180746.png

Import all projects one by one, and you have successfully completed the migration, freeing yourself from all external risks.

#Successful Setup

After the setup is complete, you can use your own private repository. Although it lacks some opportunities for mutual communication compared to large platforms like GitHub, security is the most important.


Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.