How to work with GitLab…?

1 . Introduction of GitLab

  • GitLab is a free and open source, web-based repository manager that lets teams collaborate on code, duplicate code to safely create and edit new projects, then merge finished code into existing projects. It provides centralized, cloud-based locations where teams can store, share, publish,test, and collaborate on web development projects. Its permissions, branch protection, and authentication features are what really make it stand out. Teams can secure projects on a more granular level, and projects are kept even safer while they’re being worked on.

2 . Advantages of GitLab

  • A convenient user interface enables users to access everything from one screen: projects, latest projects, users, latest users, groups, and stats.
  • Settings allow users to control whether a repository is public or private.
  • “Snippet support” lets users share small pieces of code from a project, without sharing the whole project.
  • Protected branches are a new way to keep code safe. They allow users to set higher permissions on a project, so only certain people are able to push,force push, or delete code in a branch.
  • Authentication levels take this security a step further, allowing users to give people access beyond a read/write level. For example, you can give a team member access to issue tracking without having to give them access to the code itself.
  • Improved milestones enable you to set milestones at a group level, not just a developer-specific level. Developers can get insight into the whole team’s scope and view the entire project’s milestones, not just their own.
  • You can attach files like comments to any communications in GitLab.

3 . Installing GitLab


  • Download the latest Git For Windows Installer from https://git-scm.com/download/win
  • When you’ve successfully started the installer, you should see the Git Setup
  • Open a Command Prompt (or Git Bash if during installation you elected not to use Git from the Windows Command Prompt).
  • Run the following commands to configure your git username and email using the
  • following commands. These details will be associated with any commits that you create:
    • git config -–global user.name “Your Name”
    • git config -–global user.email “Your Email”


  • From your shell, install Git using apt-get:
    • sudo apt-get update
    • sudo apt-get install git
  • Verify the installation was successful by typing
    • git –version
  • Configure your git username and email using the following commands. These details will be associated with any commits that you create :
    • git config –global user.name “Your Name”
    • git config –global user.email “Your Email”

4 . Creating a project in GitLab 

  • After creating your account in a GitLab you can see the dashboard. In your dashboard, click the green New project button or use the plus icon in the upper right corner of the navigation bar.This opens a new project page.

  • Provide the following information to create new project:

    • Enter the name of your project in the Project name You can’t use special characters, but you can use spaces or hyphens.
    • If you have a project in a different repository, you can import it by clicking an Import project from button provided this is enabled in your GitLab instance.
    • The Project description (optional) field enables you to enter a description for your project’s dashboard, which will help others understand what your project is about.
    • Changing the Visibility Level modifies the project’s viewing and access rights for users. Click Create project.

4 . Cloning the project

  • In Git, when you copy a project you say you “clone” it. To work on a git project locally , you will need to clone it. To do this, sign in to GitLab.
  • When you are on your Dashboard, click on the project that you would like to clone. To work in the project, you can copy a link to the Git repository through a SSH or a HTTPS protocol. While you are at the Project tab, select HTTPS and copy the link using the ‘Copy to clipboard’ button.GitLab
  • Command for cloning :
    • Go to your computer’s shell and type the following command and a clone of the project will be created in your computer.
      • git clone PASTE HTTPS HERE

5 . Adding changes to the project

  • To add the changes in the project, git add is used.

  • Command for adding : 
    • Go to your computer’s shell and type the following command :
      • git add 
      • The changed files will be added to the project.

6 . Committing changes to the project

  • To commit the changes in the project, git commit is used.

  • Command for commit changes :
    • Go to your computer’s shell and type the following command :
      • git commit –m “commit message”
      • The changed files will be committed to the project.

7 . Pushing project to main repository

  • Uploading of project to main repository is done with git push.

  • Command for push changes:
    • Go to your computer’s shell and type the following command:
      • git push origin master
      • Enter the password if asked. The changed files will be pushed to the original project.

8 . Forking a project

  • A fork is a copy of an original repository that you can put in another namespace where you can experiment and apply changes that you can later decide if publishing or not, without affecting your original project.

  • Steps to fork a project in GitLab:
    1. Go to a project’s dashboard under the Project tab and click on the Fork button
    2. You will be asked where to fork the repository. Click on the user or group to where you’d like to add the forked project.
    3. After a few moments, depending on the repository’s size, the forking will complete.

9 . Branching a project

  • Branching offers a way to work on a new feature without affecting the main codebase.Each time, that you want to commit a bug or a feature, you need to create a branch for it, which will be a copy of your master branch.

  • When you do a pull request on a branch, you can continue to work on another branch and make another pull request on this other branch.

  • Command for Branch a Project:
    • Go to your computer’s shell and type the following command:
      • git checkout -b
      • The branch of the master project will be created.

So, that all for GitLab tutorial. Using this tutorial you can easily learn GitLab and upload your projects online with private security.

Thank You . 🙂

Be the First to comment.

Leave a Comment

Your email address will not be published. Required fields are marked *

%d bloggers like this: