If you are a software developer or you are linked to software development you might know what is Git and GitHub.

For those who don’t know what is GitHub, GitHub is a web service based on the software Git (which is a versioning software written by Linus Torvald, creator of Linux). Git allows you to store the history of your software code base and easily control versioning. GitHub host all those Git repositories and also provides many other features like bug tracking, milestone creation and also the creation of Wiki for your project.

In this article, you will learn how to host your own git server like GitHub on your raspberry pi using GitLab.

Why do your want to host your local Git server?

GitHub is pretty amazing. It may satisfy all your code hosting requirements. But there are three main reasons to host your own git server.

  1. GitHub is free only for the public projects only. If you don’t want to make your software open source then you have to buy the GitHub subscription plans. Now you may make project for hobby or you have a start-up company with the relatively small team. In that case of you don’t want to buy those expensive subscription plans, you have to host your git server.
  2. If you want to use GitHub or any other git servers, you have to trust the third party for hosting your data. If you want to keep your data/source code secure and also want to control over where your data is being host, you have to host a local Git server.
  3. It’s really fun. Really!!!

The easiest and the cheapest way to create these type of Git server is by using the most versatile and cheap Raspberry Pi.

What do you need for this project?

- A Raspberry Pi 3. (Raspberry Pi 3 is recommended as it has 64 bit CPU and GitLab requires a 64-bit architecture.)

- Power supply to feed your raspberry pi.

- 16 or 32GB microSD card to store the Git reposetory. (Make you have the latest version of Rasbpian Jessie flashed on the SD card and your SSH is enabled.)

How to install GitLab on Pi?

Installing GitLab on the Raspberry Pi is very simple. It’s just 4 simple steps and that’s it! You are all done. Let’s get started.

First, login to your raspberry pi terminal using SSH and flow below steps.

1. Install required dependencies.

This command will install postfix on your raspberry pi. If you want to send emails from your GitLab server please select ‘Internet Site’ during setup.

2. Install GitLab CE (Community Edition) server.

3. Configure and start GitLab.

4. Set up your GitLab account.

Keep in mind that your default account’s username is root.

Conclusion:

So, now you learned how you can host your own Git server at your home. This will cost you less than $50. But, it will provide you complete control over your codebase.

Later if you want to migrate to any of online git server, you can easily change your Git hosting by easily adding a remote pointing to the online repository.

~If you liked the article, click the 💚 below so more people can see it! Also, you can follow me on Medium or on My Blog, so you get updates regarding my future articles!!~