What is GitLab and How To use It?

GitLab was America's fourth fastest-growing private software company in 2018. The company provides a central server that manages Git repositories and is used to simplify the administration tasks of many corporations worldwide. According to Wikipedia, GitLab has over 100,000 users and is used by large, well-known organizations such as IBM, Sony, Goldman Sachs, and NASA.

This GitLab tutorial includes the following topics:

  1. What is Git?
  2. What is GitLab?
  3. Demo - the first project in GitLab

Before we get into GitLab's details, let's first get an understanding of its relevance by taking a look at a use case—Goldman Sachs.

Goldman Sachs Group, Inc. is a multinational investment bank and financial services company, providing services in investment management, securities, asset management, prime brokerage, and security underwriting. The organization has offices in many major financial centers around the world and operates with over 38,000 employees.

Even huge organizations like Goldman Sachs face their unique issues and obstacles. Some of the most significant challenges faced by Goldman Sachs were:

Challenges

  1. To increase software quality and developer efficiency, enable concurrent development activities, and achieve faster development cycles.
  2. To find a tool that could remove toolchain complexity and manage everything in one user interface (UI).

Solution

GitLab to the rescue!

GitLab helped the engineering teams remove toolchain complexity and accelerate DevOps adoption. It enabled the team to develop an application that allowed Goldman Sachs' developers to manage all efforts with one UI and simplified the administration by employing one centralized instance for all repositories.

Now that you've seen one example of GitLab's applicability, let's focus on its basics. To best grasp GitLab's basics, we must begin by understanding the "Git" part of the name.

DevOps Engineer Master's Program

Bridge between software developers and operationsExplore Course
DevOps Engineer Master's Program

What is Git?

Git is a version control system used to track changes in computer files. Git's primary purpose is to manage any changes made in one or more projects over a given period of time. It helps coordinate work among members of a project team and tracks progress over time. Git also helps both programming professionals and non-technical users by monitoring their project files. 

Git can handle projects of any size. It allows multiple users to work together without having affecting each other's work. 

gitlab

Now that we've been briefed on Git's basics, let's take a look at the hosting repository, GitLab.

What is GitLab?

GitLab is a web-based Git repository that provides free open and private repositories, issue-following capabilities, and wikis. It is a complete DevOps platform that enables professionals to perform all the tasks in a project—from project planning and source code management to monitoring and security. Furthermore, it allows teams to collaborate and build better software. 

GitLab helps teams reduce product lifecycles and increase productivity, which in turn creates value for customers. The application doesn't require users to manage authorizations for each tool. If permissions are set once, then everyone in the organization has access to every component.

To access more functionalities, customers can opt for the paid version of GitLab, starting at $4 per user, per month.

gitlab-2

To better understand the basics of GitLab and its functionality, let's have a look at a demo.

Learn the basics of Git VCS and understand how to setup Git in your system with the Git Training Course. Check out the course now.

GitLab Tutorial Demo - Making Your First Project in GitLab

Open gitlab.com

Log in to your account.

After logging in, create a new project.

Choose a name, a description, and whether you want it to be private or publicly visible.

git-bash

Open your Git Bash

For the first step, to configure your user name and email ID.

To configure, use the following commands:

Git config --global user.name "tutorial"

Git config --global user.email ishan.gaba@simplilearn.net



Then, create the first repository.

To create a repository in the working directory, use the following commands:

mkdir tutorial

cd tutorial

mkdir

Now you can navigate to this repository, using the following command:

pwd

pwd

After navigating to this folder, you will find that the folder is currently empty.

Now it's time to initialize a git repository. To initialize a repository, use the following command:

Git init

git-init.

You will notice that something called the "master" appears on the screen. Whenever a Git repository is created for the first time, it creates a branch, and it's called the master.

Navigate to the folder, and find the hidden ".git" folder. 

git-folder


If you check the folder, you can see several directories and configurations. Make sure you don't make any changes to any of the directories.

This is created when a repository is initialized. 

Now, create a notepad for the repository. Later on, you can push that file onto the GitLab repository.

To create a notepad, use the following commands:

touch input.txt

notepad input.txt

notepad-input

Notepad will appear on the screen. Type anything inside it, then save and close it.

save-changes

The next step is to check the status of the file.

git status

This shows that there isn't a file committed yet, and there are untracked files. The untracked files can be seen in red.

Now, add the file to the staging area with the following command:

git add.


The next step is to commit the file. To commit, use the commit command.

git commit -m "input"

Recheck the status of the file.

git status

git-status

You'll notice that there are no more commits to be made, as there was a single notepad, and that was committed in the previous step.

Now, it's time to push the notepad onto the GitLab repository.

To accomplish this, go to your GitLab and copy the git remote origin command, as shown below.

remote-origin

After you have done this, go back to your Git Bash and paste the command.

paste-the-command

Now use the remote command, followed by the push command, to push the file to the remote repository.

git remote -v

git-remote

git push -u origin master

origin-master

Now go to your GitLab and check to see if there are any additions to the new project you initially created.

You can see that the notepad appears there. You can now open and check the contents of the notepad.

tutorial

Enroll in DevOps Engineer Masters Program and learn to work on tools like Docker, Git, Jenkins, Puppet & Nagios.

Conclusion 

I hope this tutorial has helped you understand the relevance of GitLab. You have learned the basics of Git and its remote repository, GitLab. By the tutorial's end, you saw how GitLab works, thanks to the hands-on demo.

Want to Learn More?

If you want to kickstart your career in DevOps, check out our DevOps Engineer Master's Program today. In this comprehensive program, you will learn about all the concepts, tools, and techniques to become a certified DevOps professional—a job role that is high-demand in today's fast-paced digital world.

About the Author

Ishan GabaIshan Gaba

Ishan Gaba is a Research Analyst at Simplilearn. He is proficient in Java Programming, Data Structures, and Project Management. Graduated in Information Technology, Ishan is also passionate about writing and traveling.

View More
  • Disclaimer
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.