Install GitLab on Raspberry Pi: Your Own GitHub Server at Home
When I can self-host a tool instead of relying on a cloud service, I’m always tempted to try it. GitHub is great, but since its acquisition by Microsoft, I also understand why some developers prefer keeping their code on a private server. GitLab makes that possible, and a Raspberry Pi can be a cheap way to test this kind of setup at home.
GitLab can be installed on Raspberry Pi OS by adding the official GitLab repository, then installing the Community Edition package with APT. A Raspberry Pi 4 or newer is recommended for better performance.
In this post, I’ll begin with an introduction about Git and GitLab and why you need to use them.
Then, I’ll show you how to install GitLab and how to use the basic functions of this software.
If you’re like me and sometimes mix up syntax between programming languages, I’ve got just the thing for you. I’ve put together a Python cheat sheet with all the essential syntax in one place, so you can keep it handy and avoid any confusion. Download it here for free!
Git, GitHub, and GitLab: What’s the Difference?
So what’s the difference between Git, GitLab, and GitHub? Let me give you a quick primer.
Git
Git is a code manager used to share sources between all developers from the same project. It allows concurrent editing of the same files, and even if you’re working solo, it’s a useful tool to back up your code and note the changes you make.
If you’re familiar with them, the goal is the same as with SVN (Subversion) or CVS (concurrent version system).
The main difference is that Git doesn’t require a centralized server to work; instead, Git uses the developers’ computers to store files. (If you’re the only developer on a project, however, it’s still advised to install Git on a server to make sure your code is safe.)
GitLab
GitLab is precisely that missing server in the default Git architecture.
It provides you a backup host with a web interface to manage your project.
In the beginning, GitLab was just a tool to see your source code from a web interface. But since then, GitLab has added new features that make it feel like an essential tool in any Git project.
You can get answers from real experts in minutes.
Get help with your setup

GitLab is a free and open-source software.
You can also use their managed cloud if you prefer, for a subscription price between $0 and $99.
In this tutorial, I’ll show you how to install a free version on your Raspberry Pi.
Why Not Use GitHub Instead?
GitHub is now a service where you manage your Git repositories.
But as I mentioned, you can’t control what they do with your source code and information.
Bonus tip: : Instead of Googling syntax every time, I keep a small cheat sheet with the main Python elements. Check it here.
Want to build real Raspberry Pi projects with Python? This book starts from scratch and guides you toward practical scripts, automation, APIs, cameras and more.
Learn Python on Raspberry PiFor small projects, GitHub is fine, you can get quickly get free hosting for your source code.
For bigger projects or for companies, I’m not sure if it’s the best option.
You can’t guarantee that your data is safe, especially since Microsoft is in charge of it.
Read next: The Raspberry Pi I'd actually buy today
GitLab also keeps providing more and more tools to manage your project.
For example, permissions management is more accurate on GitLab. This allows you to add not only developers on GitLab but all kinds of people that need to work on the project.
In short, another way to think about it is that GitLab is your private and self-hosted GitHub.
Installing GitLab on Raspberry Pi
Here are the big picture steps to install GitLab on a Raspberry Pi:
- Prepare your OS.
- Install dependencies for GitLab.
- Add the GitLab repository to install the GitLab package.
Let’s cover each on in detail
Prepare Your System
To follow this tutorial, your Raspberry Pi needs to use Raspberry Pi OS.
Any version is fine, Raspberry Pi OS Lite is enough as we don’t need a GUI to install GitLab.
If you need help with this, follow my step-by-step guide to installing Raspberry Pi OS.
Once Raspberry Pi OS is installed, follow these steps to prepare the system:
- Enable SSH if not already done:
sudo raspi-config - Navigate to Interface options > SSH, and choose Yes to enable it.
I have a full guide about SSH here if you need a more step-by-step explanation. - Update your system:
sudo apt update
sudo apt upgrade
sudo reboot
Tip: Command lines can be a pain to memorize. I put the essential Linux commands on a printable cheat sheet so you don't have to keep googling them. You can grab the PDF here if you want to save some time.
After rebooting your system, you’re ready to move on to the next step.
Install Dependencies
GitLab needs some dependencies before the repository installation.
Most of them are already pre-installed on Raspberry Pi OS, but you will probably need to install at least Postfix (for email notifications).
Here’s the command to install all of them:sudo apt install apt-transport-https postfix

Type “Y” to continue.
A configuration screen for Postfix will pop up.
Choose “Internet site” and enter your DNS name if you have one.
You can change this later if you want email notifications, not a big deal, continue the installation.
Install the GitLab Package
GitLab isn’t found in the default repository, so we’ll have to add its repo to install it.
We’ll be installing gitlab-ce. CE is the free and self-hosted Community Edition.
- Add the GitLab repository by using their official script:
curl --location "https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh" | sudo bash
- Refresh to get the new package list:
sudo apt update - Install the GitLab package.
sudo EXTERNAL_URL="http://192.168.1.15" apt install gitlab-ceReplace the EXTERNAL_URL value with your IP address or the DNS name you want to use (don’t use an HTTPS address for the moment).
The package weighs almost 1GB, so it can take some time to download, unpack, and install it.
When it’s all done, you’ll get a success splash screen with some important details:

First Steps With GitLab on Raspberry Pi
Now that you’ve got GitLab installed on your Raspberry Pi, let’s learn how to use it.
In this section, we’ll go over how to log in to the GitLab web panel and create your first project.
Access the GitLab Web Interface
Once the installation is done, you can access the web interface at http://<EXTERNAL_URL>.
Use the same URL that you defined in the installation command.

Use these credentials to log in:
- Login = root
- Password = auto-generated by the installation.
You can find it in the /etc/gitlab/initial_root_password file:
Bonus tip: : Instead of Googling syntax every time, I keep a small cheat sheet with the main Python elements. Check it here.
Once logged in, change your password right away, as it’s not safe to be stored in plaintext.
Here’s how to change your GitLab password:
- Click your Avatar icon > Edit profile in the top right.
- On the left menu, go to Access > Password and authentication.
- Finally, click the Change password button.

If you need more information about the GitLab configuration, you can find all the answers in the GitLab docs.
Create Your First Project
Once logged in the GitLab interface, you will get a home page like this:

Click “Create a project,”choose “Create a blank project,” and fill in the form:

Choose the options that fit what you want to do best, and click “Create project” to finish.
You can also use a template or import an existing Git project.
Once the project is created, you can use it as usual with the Git command:

The project interface is really close from what you get on GitHub.
For example, to clone my test project on my other Raspberry Pi:git clone http://192.168.30.19/root/my-test-project.git

That’s it, you know how to install GitLab on your Raspberry Pi and how to use it.
It’s a cool alternative to GitHub if you worry about data privacy and want to keep control.
But don’t forget to make backups if you don’t want to take the risk of losing everything.
Check my guide on how to back up your Raspberry Pi if you need more information about that.
Still stuck after following this guide? Drop your question in the RaspberryTips Community — real Pi users answer fast. Post your question here.
Related Questions
Is it a good idea to use GitLab on my Raspberry Pi?
It seems to work fine once the optimization issues are fixed. But I’m not sure it’s the best idea. It’s good to try in order to make sure you can achieve what you want. But for the long term, you’ll need a more powerful device, and with less corruption risk (SD card is not the safest storage).
Where can I find the GitLab configuration file?
From what I found, everything seems to be in the /etc/gitlab/gitlab.rb file. Options are not always intuitive, but you should find help on the GitLab website and forum.
Not getting the same result?
Even when you follow every step, small differences in OS version, hardware or config can change the outcome. Instead of wasting time guessing, get help from people who have already fixed the same kind of issue.
- Get help on your exact issue
- Access step-by-step videos for tricky setups
- Browse the website without ads
