We hope you find this tutorial helpful. In addition to guides like this one, we provide simple cloud infrastructure for developers. Learn more →

How To Use the GitLab One-Click Install Image to Manage Git Repositories

Posted Nov 12, 2013 129.3k views Git One-Click Install Apps Ruby on Rails Ubuntu


Collaborating on projects, keeping track of source changes, and maintaining a clean code repository are some great reasons to use a version control system. Version control is now considered an essential tool in software development.

Git is the most popular distributed version control system. GitLab is a git repository management server that can be used to host repositories and set up control structures for git within a clean web interface. It is built on Ruby on Rails.

DigitalOcean has created a GitLab application image that can be used to instantly deploy GitLab on a DigitalOcean droplet using their Omnibus installer. You can have your own repository system up and running in minutes.

Step One –– Create a GitLab Droplet

Before you begin using GitLab, you need to spin up a DigitalOcean droplet using the provided image.

From the Control Panel, click on the "Create" button that is visible from any page:

DigitalOcean create droplet button

Choose a name, the droplet size, and the region you would like to use.

The GitLab documentation recommends a minimum of 2GB of RAM and 2 CPU cores for optimum performance. If your projects are small (fewer than 100 users total), 1GB of RAM and 1 CPU core may be sufficient:

DigitalOcean hardware selection

Scroll down the page. Under the "Select Image" section, choose the "Applications" tab and click the "GitLab 6.9.1" image.

Add any SSH Keys, select any settings you'd like to use, and click "Create Droplet" at the bottom:

DigitalOcean finalize droplet

Your GitLab droplet will be created!

Step Two –– Configure Domain Names and Emails

We still need to configure just a few things first to utilize our environment.

Begin by setting up any domain names you would like to use for your GitLab instance. To learn how to set up domain names on DigitalOcean, click here.

Once your domain name is configured correctly, you need to adjust some values on the actual VPS instance. Log into your droplet as root through SSH, and open the GitLab configuration file with your text editor:

nano /etc/gitlab/gitlab.rb

Uncomment and adjust the external_url parameter to match your domain name. Your URL should end with a slash:

external_url "http://your_domain.com/"

If you have generated an SSL certificate for your domain, you can configure GitLab to use them in this file as well:

nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.example.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.example.com.key"
nginx['redirect_http_to_https'] = true

While we're in this file, we can adjust the email settings that GitLab will use in the "From:" field in automated emails, and the email published for support contact, respectively:

gitlab_rails['gitlab_email_from'] = "gitlab@domain.com"
gitlab_rails['gitlab_support_email'] = "your_email@domain.com"

The GitLab One-Click application is configured to use a local postfix server for sending emails. For a production site, you will likely want to use an external service such as Mandrill or SendGrid. If so, you can configure SMTP settings here as well.

After saving and closing the file, we just need to reconfigure the service:

gitlab-ctl reconfigure

This should be done when ever you make configuration changes in order for them to take effect.

Step Three –– Log into your GitLab

When you connect to your GitLab instance via SSH or the DigitalOcean web console, you will see the message of the day (MOTD) which contains your randomly generated GitLab password. It will look like this:

Thank you for using DigitalOcean's GitLab Application.
Your GitLab instance can be accessed at http://xxx.xxx.xxx.xxx/
The default credentials for GitLab are: 
Username: root
Password: e0wXRM4fLmb6

You can find more information on using this image at: http://do.co/gitlabapp

Next, open a web browser and navigate to your domain name (or the IP address of your Droplet if you did not set up a domain name). You will now be able to log in using the credentials you found above.

DigitalOcean GitLab log in

You now have a full GitLab server configured and at your disposal to manage your repositories:

DigitalOcean GitLab landing page

Step Four –– Modify Account Information

It would probably be more helpful if the account you're using more accurately reflected your information. This will allow you to receive email updates and will display your information to other users.

First, click on the "Admin area" icon in the top-right corner:

DigitalOcean GitLab admin button

On the next page, look for a list of "Latest users" in the bottom middle column. This should only contain one user, the Administrator account you are logged into. Click it:

DigitalOcean GitLab admin user

Click on the "Edit" button in the upper-right corner:

DigitalOcean GitLab edit userpage

Change the account information at the top.

The "Name" field will be your name as displayed to other users. The "username" can be used to log in and as an owner of repositories. The "email" is where alerts will be sent.

It is important to at least change the email field:

DigitalOcean GitLab modify info

Click "Save changes" at the bottom. You should receive a confirmation email in your inbox. This will also allow you to receive password reset emails if you ever require it.

Updating to Newer Releases

The GitLab One-Click application is configured to use the GitLab Apt repository. So upgrading to the most recent version is as simple as running:

sudo apt-get update
sudo apt-get upgrade

Before upgrading to a new release, you may wish to make a back up of your existing installation. To do so, run:

sudo gitlab-rake gitlab:backup:create

The resulting backup will be located in: /var/opt/gitlab/backups


You should now have a server configured to handle your team's git projects. You can easily manage user access, configure both public and private repositories, and get an overview of your projects' issues and commits.

GitLab has a great help system accessible from within the user interface. In a future article, we will discuss how to manage repositories and users and effectively take advantage of the interface.

For further information on configuring you GitLab Omnibus installation, check out their official documentation.

By Justin Ellingwood


Creative Commons License