How to install GitLab on your Raspberry Pi?

GitLab allows you to create a private GitHub-like server at home, on your Raspberry Pi.
Since the acquisition of GitHub by Microsoft you are many to worry about data privacy. Many companies moved to other platforms, and the cheapest solution for individuals is to use a private Git server (on Raspberry Pi for example).

As GitLab has an apt repository dedicated to Raspberry Pi, the installation is straightforward.
After installing the prerequisites, we can add the repository, install the GitLab package and configure it.

In this post, I’ll start with an introduction about Git and GitLab and why you need to use it
Then I’ll show you how to install GitLab and how to use the basic functions from this software

GitLab introduction

Git reminder

Git is a code manager, to share sources between all developers from a same project
It allows concurrent editing of the same files, and even if you are alone, it’s a good tool to back up your code and note the changes you make

If you know them, the goal is the same as with SVN (Subversion) or CVS (concurrent version system)
The main difference is that Git doesn’t need a main server to keep files, but it’s using the developers computers to store this
You should however install git on a server to make sure your code is safe if you are the only developer

Raspberry Pi Bootcamp
Take it to the next level.
I'm here to help you get started on Raspberry Pi.
Learn all the skills you need in the correct order.

GitLab presentation

GitLab is precisely the missing server in the default Git architecture
It provides you a backup host with a web interface to manage your project
At the beginning GitLab was just a tool to see your source code on a web interface
But since then, GitLab didn’t stop adding new features to this product in order to make it an essential tool in any Git project

GitLab is a free and open source software
But you can use it in the cloud if you prefer, for a price between 0 and $99

In this tutorial, I’ll show you how to install it for free on your Raspberry Pi

Why not use GitHub instead?

GitHub is a fantastic service to manage your Git repositories
But as I already said, you don’t control what they do with your source code and your information

For small projects, GitHub is fine, you can get an hosting for your source code for free and quickly
For bigger projects or for companies I don’t know if it’s always the best option
You can’t be sure that your data is safe, especially since Microsoft is in charge

GitLab also provides 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 kind of people that need to work on the project

GitLab installation

Prepare your system

To follow this tutorial, your Raspberry Pi needs to use Raspbian
Any version will be fine, Raspbian Lite is enough as we don’t need an interface to install GitLab

If you need help on how to install Raspbian on Raspberry Pi, click on the link, this is a step-by-step installation guide for beginners, all you need is in this guide

Once the Raspbian installation is complete, follow these last steps to achieve the system preparation:

  • Enable SSH if not already done
    sudo raspi-config

    Then go to “Interfacing options” > “SSH” and choose “Yes”

  • Update your system
    sudo apt update
    sudo apt upgrade
    sudo reboot
  • After the reboot you are ready to move to the next step

Install dependencies

GitLab needs some dependencies before the repository installation
For example, we need curl to download the repository key and postfix to send email notifications with GitLab

Here is the command to install all of them:

sudo apt install curl openssh-server ca-certificates apt-transport-https postfix

Type “Y” to continue
In the Postfix configuration, 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

Master your Raspberry Pi in 30 days
Download the eBook.
Uncover the secrets of the Raspberry Pi in a 30 days challenge.
Learn useful Linux skills and practice multiples projects.

Add the GitLab repository

  • Start by adding the apt key for the repository
    curl | sudo apt-key add -
  • Then run the script to add the repository automatically
    sudo curl -sS | sudo bash

    If everything goes fine, you get the success message “The repository is setup! You can now install packages.”

Install the GitLab package

We can finally install the GitLab package with:

sudo EXTERNAL_URL="" apt install gitlab-ce

Replace the EXTERNAL_URL value by your IP address or the DNS name you want to use (don’t set a HTTPS URL for the moment)
The package weights 500Mb so it can take a few minutes to download it with low connection speed
And the installation also takes a long time to unpack and install GitLab

Don’t be afraid by all the messages appearing on your screen, it’s … normal

My Raspberry Pi 3B+ has almost crashed during the installation process (40 in load average) and I got an error (timeout)
If you have the same issue, restart the installation with: sudo apt install -f

Login on the GitLab interface

Once the installation is done, you can access the web interface on http://<EXTERNAL_URL>
Use the same URL as defined in the installation process

Log into the interface with:

  • Login: root
  • Password: It will prompt you to create one on your first visit

gitlab log in

If you need more information about the GitLab configuration, you can find all the answers in the GitLab docs

GitLab usage

Fix error 502

If you are not able to access the web interface, because of a high load average, I got the same issue
I had something like 40 of load average, just to display one page, and a lot of timeout

I cross my fingers because I’m not sure it’s definitive
But since I increased my swap size, it seems to go better

To increase your swap size you need to follow these steps:

  • Disable the swap usage
    sudo dphys-swapfile swapoff
  • Edit this file
    sudo nano /etc/dphys-swapfile
  • Change the value of the swap size
  • Confirm the change (creation of the new file)
    sudo dphys-swapfile setup
  • Then enable the swap again
    sudo dphys-swapfile swapon

Maybe you need a reboot to apply changes in the GitLab apps

Create your first project

Once logged in the GitLab interface, you will get a home page like this:

gitlab home page

Click on “Create a project” and fill the form

gitlab new project

Choose the options that fit the best to what you want to do and click on “Create project”
You can also use a template or import an existing Git project

Once the project is created (I got another laggy moment here, but it works), you can use it as usual with the git command

gitlab project ready

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

gitlab clone

Related questions

Is it a good idea to use GitLab on a Raspberry Pi? It seems to work fine once the optimization issues were fixed. But I’m not sure it’s the best idea. It’s good for a try, to make sure you can do what you want with it. But for the long term, you need to find a more powerful device, and with less corruption risk (SD card is not the safer storage)

Where is the GitLab configuration file? To 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


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 the 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

This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Patrick Fromaget

I'm the lead author and owner of My goal is to help you with your Raspberry Pi problems using detailed guides and tutorials. In real life, I'm a Linux system administrator with a web developer experience.

Leave a Reply

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

Recent Posts

Master your Raspberry Pi - 10% off