Skip to main content

Git Repository Management with Gitlab

By Monday June 6th, 2016Developer's Corner

What is Gitlab?

Gitlab is respository manager developed by Gitlab, Inc. Gitlab provides easy access control, code reviews, issue tracking, activity feeds, wiki, and continuous integration. Tens of thousands of organizations currently use Gitlab to manage their repositories.

Compared to other SaaS (github, bitbucket), Gitlab allows you to host the repos on your own servers. This is crucial when you need to manage git while access to an external network environment is restricted. Most importantly, Gitlab becomes a means of implementing a Central Management System.

This article will guide you through installing Gitlab and getting it up and running.

Installation

In this guide we will install Gitlab on CentOS(Version 7.1). If there any changes to the installation process, you can find them here: https://about.gitlab.com/downloads/#centos7

  1. Install the necessary dependencies for CentOS. You’ll need the following commands:
    Note: In the picture below “> /dev/null” is not necessary. It simply means that the command’s output will be flushed

    sudo yum install curl policycoreutils openssh-server openssh-clients
    sudo systemctl enable sshd
    sudo systemctl start sshd
    sudo yum install postfix
    sudo systemctl enable postfix
    sudo systemctl start postfix
    sudo firewall-cmd --permanent --add-service=http
    sudo systemctl reload firewalld


    117
  2. Add the Gitlab package server and install the package
    curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
    sudo yum install gitlab-ce
  3. Configure Gitlab
    sudo gitlab-ctl reconfigure

Installation is now complete! Now lets access Gitlab via our web browser.

Administrator Settings

  1. First thing you’ll want to do is access the console and change the root (administrator) password

    // Execute gitlab console
    gitlab-rails console production
    // search admin user
    user = User.where(id: 1).first
    or
    user = User.find_by(email: 'admin@local.host')
    // change password user
    user.password = 'password_to_change'
    user.password_confirmation = 'password_to_change'
    //save changes
    user.save!

    118
  2. Login using your credentials and access the Admin Area.
    go to admin
  3. We recommend you adjust Sign-in Restrictions and disable “Sign-up enabled”. Also, make any desired changes to Access Control.You can manually add and invite new users through email in the Admin Area -> Users -> New User section.
    122

First Look and Creating a New Project

This is your control panel:

123

Go to Projects and click New Project to create a project. Create a project from scratch or import an existing one. Don’t forget to set your visibility levels depending on your requirements.

124

Your local centralized git repository management system is functional!

Test Connection using HTTP

Now we’ll test a connection using TortoiseGit. If your system does not have Git or TortoiseGit you can download them from their respective official websites:

Git url: https://git-scm.com/
Tortoisegit url: https://tortoisegit.org/

To follow this tutorial, you must select Openssh Client when installing TortoiseGit. We recommend rebooting your client machine after installing Git and TortoiseGit.

  1. Access Gitlab’s project page. Set to HTTP and copy the repository URL125
  2. Choose the directory to which you’d like to clone the repository. Navigate to your desired directory on the client machine, right click, and select “Git Clone.”
    126
  3. You’ll see the following dialog box with the URL automatically filled in. Click OK to begin the cloning process.127
  4. You may be prompted for your authentication credentials. Success!128

In our next post, we’ll introduce how to connect to the Git server using Xshell with SSH and TortoiseGit.

Leave a Reply

one + 20 =