Nowadays git is the default versioning management system on the enterprise, and on personal / open source projects, it is for me and as far as I know other companies it is for all of them exept by one.

Companies have several options on how to host their git repositories. A really good option is to pay one of the incredibly great services provided online such as the outstanding Github or Bitbucket which both offer really good capabilities at low prices for startups and scales as you need more repos or developers. It really scales to high prices for big companies, but big enterprises usually have big budgets.

Companies are very jealous about their codebase and many don't want their code to be hosted on the cloud. Yes they create cloud based applications, cloud based platforms, sell cloud as the magic word to customers, etc, but at the moment of truth ... they want their code in-house (sic).

One solution to this 'problem' is again use Github, in this case Enterprise Edition, or Atlassian Stash installed on your server, of course this options are much more expensive and prices scale rapidly.

On the other hand to paliate this budget issue you have several open source options at no expense being gitolite the most widely spread and the simplest as well.

But we are going to talk about another option, not so well known for the mainstream, Gitlab which in fact is a paid in-house service as well but comes with a Community Eddition that can cover most of the use cases perfectly.

Gitlab not only comes with a preinstalled git repository and a useful web front-end to manage it (handy for non technical people, product owners, project leaders, and bossess in general) but it even comes with a Continuous Integration service (gitlab-ci)!

As Gitlab team itself comments:

Git repository management, code reviews, issue tracking, activity feeds and wikis.

So we're going to start by installing Gitlab CE on a Vagrant box but it could be done on any machine. In a future posts we'll manage repositories and use the Continuous Integration server.


scriptDir = File.dirname(__FILE__)

Vagrant.configure(2) do |config| = "bash -c 'BASH_ENV=/etc/profile exec bash'" = "ubuntu/trusty64"

    config.vm.hostname = "Gitlab" "forwarded_port", guest: 80, host: 8080 "private_network", ip: ""

    config.vm.provider "virtualbox" do |vb|
        vb.customize ["modifyvm", :id, "--memory", "2048"]
        vb.customize ["modifyvm", :id, "--cpus", "1"]
        vb.customize ["modifyvm", :id, "--name", "Gitlab"]
        vb.customize ["modifyvm", :id, "--cpuexecutioncap", 30]
        vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
        vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
        vb.customize ["modifyvm", :id, "--ostype", "Ubuntu_64"]

    config.vm.provision "shell" do |s|
        s.path = scriptDir + "/"

Nothing special with this Vagrantfile exept for the shell provisioning provided in file which contains the necessary instructions to install Gitlab, lets have a look at it:

#!/usr/bin/env bash

sudo apt-get purge xorg lxde xinit openbox lightdm
sudo apt-get autoremove
sudo apt-get clean

sudo apt-get update -y
sudo apt-get install -y vim curl openssh-server ca-certificates postfix &> /dev/null

curl | sudo bash

sudo apt-get install gitlab-ce

sudo gitlab-ctl reconfigure

sudo gitlab-ctl status

In case you are not using an ubuntu based system head to, there you have the instructions needed to modify the script for your distro.

With this two files in place you only need to vagrant up and wait a fair amount of time, I'm saying more, a lot of time as the installation takes longer than I'd like. At the end you have a working Gitlab installation you can access directly on your browser and use user root and pass 5iveL!fe to access your newly git repository manager. (Note I used as IP for the box in Vagrantfile)

Now we're going one step further, imagine you are installing Gitlab not on a vagrant box but in an enterprise server of in which you plan to give access to your users (developers) and start collaborating. In that case you need to configure Gitlab so it respond to your URL. For this purpose modify /etc/gitlab/gitlab.rb file and change this parameter:


## Url on which GitLab will be reachable.
## For more details on configuring external_url see:
external_url ''

No need of any extra configuration, just save the file and run sudo gitlab-ctl reconfigure on your console. There is though a final step, as we're configuring Vagrant we need to tell our host where to find so we add it to /etc/hosts and we are set to browse to our Gitlab installation.


Image Alt