You are on page 1of 12

Select Page

Raspberry Pi GITLab Server:

Version Control on your Pi
by Gus | Feb 25, 2017 | Beginner | 0 comments

In this Raspberry Pi Gitlab tutorial, I will be going through the steps to

setting up a piece of software called GITLab, this is basically a more
fully featured version of our GIT tutorial, but is also a lot more
demanding on the Raspberry Pi.

If you have ever used a GIT hosting service like GitHub then you will nd
GITLab a lot like that, with it providing a handy web frontend to GIT. This
can be quite useful as it provides a helpful visual interpretation of what
is happening in your GIT repository.
It also offers the ability to easily manage things like pull requests and
forks. It can be very useful to set up if you plan to utilize GIT often, or
with a team. Its a bit of a step up from the basic Pi GIT server that I
covered earlier.

Equipment List
Below is a list of the optional and recommended pieces of equipment
for this Raspberry Pi Gitlab server tutorial.

Raspberry Pi 2 or 3

Micro SD Card or a SD card if youre using an old version of the Pi.

Ethernet Cord orWi dongle (The Pi 3 has WiFi inbuilt)

Raspberry Pi Case

USB Keyboard

USB Mouse

Installing the Raspberry Pi GITLab server

The process of installing the Gitlab software is pretty straight forward. I
recommend only doing this on a fresh installation of Raspbian as the
GITLab software can be quite resource intensive. We will be installing
the community edition of Gitlab, you can check out their repository on it
over at their community edition GIT page.

1. Before we install GITLab itself, we rst need to install a few other

things. The packages we need to install are CURL, the openSSH server,
postx and a package that allows deb to support the HTTPS protocol.

We can install these by using the following command:

sudo apt-get install curl openssh-server ca-certificates postf

Note: We will need to do a few extra things when installing postx.

2. When Postx begins to install you will be greeted with the following
screen, this screen basically just explains the various options that you
can choose from.

The two easiest options to set up is the Internet Site option and the
Local Only delivery option.

The Internet site option basically allows all your mail trafc to run
through SMTP (Simple Mail Transfer Protocol). Whilst on the other hand
Local only, does exactly what it says, and only routes mail trafc locally.

Select OK and press enter to continue.

3. On the next screen, we are going to just select Local only, this is
because it is the easiest to setup.

It is also useful as we only plan to use this GITLab installation within our
local network so we dont want emails getting sent outside the local
network anyway.

Once you have selected the option you want to utilize, select OK and
press enter.
4. The next screen will be asking us to set the mail name for Postx
to utilize. You should set this to the fully qualied domain name you
intend to use for email.

For example, if I wanted to utilize I would set the

System mail name: to

Since we dont plan to utilize mail, we are just going to leave it as


Select OK and press enter to nalize installation.

5. Once that is all done, we need to grab GITLabs GPG (GNU Privacy
Guard) key, this will allow the Raspberry Pi to encrypt and sign your data
when communicating with their servers. We can download and add the
key with the following command:

curl | sudo apt-key add -

6. With that nally done, we can start the next process. That is to begin
the installation of all the packages that GITLab relies on, please note
that this can take some time as there is a fair few things that this script
needs to do.
Run the following command to download and run the installation script:

sudo curl -sS

7. Once that has nished installing we can proceed with nally actually
installing Raspberry Pi GITLab server itself, this is another process that
will take some time, it is about a 150mb download.

Run this command in the terminal to begin the installation process:

sudo apt-get install gitlab-ce

8. The nal command that needs to be run to nalize the installation of

GITLab is the one shown below, this command congures and sets up
all the settings for GITLab and installs all the required databases.

sudo gitlab-ctl reconfigure

Now GITLab should be successfully installed and ready to be used, I will

go over creating your initial repository and making the rst commit over
the next couple of steps.

Creating your rst GITLab Project

You should now have your Raspberry Pi Gitlab server up and running. Its
most likely you will want to set up your own project and repository, if you
have never done this then you should nd the following information
extremely handy.
1. To access our newly setup GitLab page we will need to go to the
Raspberry Pis local IP Address, if you dont have the IP address you can
quickly get it with the following command:

hostname -I

Once you have your Raspberry Pis IP address, load it up in your favorite
web browser, in my case I would type the following into my web browser:
2. You will now be greeted by a screen asking you to set the password
for the root account, I recommend setting something secure for this, as
this account has full control over the GitLabs account.

Once youre happy with your chosen password, press the Change your
password button.

3. Now you can login to GitLab with your new password, for the
username make sure you use root. Once you are ready, press sign in.

4. Once we are logged into GitLab we will be greeted with the

dashboard page, at the moment this contains nothing but a few buttons
to create a new group or project. For our tutorial we will be pressing the
New Project button.
5. The New Project screen is lled with a variety of different options.
GitLab allows you to import GIT projects from a vast variety of different
services, such as GitHub and Bitbucket. However, for our tutorial we will
be just creating a new repository.

The main thing we need to set in here is the project name, this is the
far-right text box for the project path. We will be using the name

We will be leaving the visibility level set to Private, this basically just
means only our user can interact with the repository unless we
specically allow another one. The two other options are Internal
which allows any logged in user to be able to clone it, and Public which
allows anyone to clone the repository.

Once you are happy with what you have set here, press the Create
Project button.

6. The screen you will be greeted with now is the empty project page,
there is not a huge amount to do here at the moment, but we will soon
be adding some les to this and populating it.
7. Now back in terminal, we will clone our brand new repository and
add our rst le. To get started we need to rst set some details, you
can change the user name and the email below to whatever you want.

git config --global "Administrator"

git config --global ""

8. With that done we can go about cloning our new repository, if you
chose to use a different project name make sure you swap out
pimylifeup with your own name.

Now to clone the repository we will run the following couple of

commands, this will grab the repository and move us into its directory.

cd ~
git clone http://raspberrypi/root/pimylifeup.git
cd pimylifeup

9. Now that we have cloned the repository, lets create our rst le and
commit it. This will just be an empty le named Readme, but this should
give you an idea on how to commit les.

To add and commit this le, run the following few commands, they
should be somewhat self explanatory.

git add
git commit -m "add readme"
git push -u origin master

10. Now you can refresh your project page and now be able to see
your new commit. You can now click on the commit and check out the
changes within the web interface rather than having to rely on Gits
command line

Congratulations, your GitLab server should now be up and running with

its rst project created. We have only really scratched the surface of
what GitLab is capable of doing, you can also use it to set up CI Builds,
manage forks and merge requests, and also utilize it to help lodge
issues and set project milestones.

I hope that this tutorial has shown you how to setup a Raspberry Pi
GITLab Server and that you havent run into any issues. Its certainly a
great Pi project for anyone who wishes to set up a solid GIT build. If you
have some feedback, tips or have come across any issues that you
would like to share then please dont hesitate to leave a comment below.
The FREE Raspberry Pi Crash
Enter your email below and get the Raspberry Pi crash
course delivered straight to your inbox!

Email G et A ccess >>

More Projects & Guides!

Raspberry Pi Print Server: Setup a

Network Printer

The Ultimate Guide to the Raspi

Cong Tool
Raspberry Pi VNC Server: Setup
Remote Desktop for your Pi

Follow Us

Search for Tutorials!

2017 Pi My Life Up | Disclaimer & Privacy Policy