Hurry! 20% Off Ends SoonRegister Now

GitLab Tutorial

Do you want to organize your project files using GitLab? If yes, then you are at the right place. This comprehensive GitLab tutorial will help you to learn from scratch. In an organization, there are lots of files and folders are required to maintain a project. GitLab places a crucial role to organize these files which are held by different people at different places. 

GitLab is a robust and well-integrated Continuous Integration and Continuous Deployment (CI/CD) pipeline that helps developers to track changes in the files. It was launched in 2014 by GitLab Inc. came with ultimate features that make developers work easier. Now, let’s go further to learn more about GitLab.

GitLab Tutorial for Beginners

What is GitLab

GitLab is an open-source web-based Git repository that is a complete DevOps platform that allows professionals to work on all kinds of tasks in a project such as planning, code management, monitoring, and security. It empowers team productivity and improves the product life cycle, which adds value to the customer. GitLab is a DevOps platform that allows monitoring source code, sharing work on multiple projects, and builds more optimized software.

  • GitLab helps to manage Git repositories on a centralized server. 
  • Git Commands are used in the Git repository
  • It offers free public and private repositories, wikis, and issue-tracking.
  • GitLab provides a Continuous Integration (CI) system to manage projects and User Interfaces with features of GitLab.
  • It is a user-friendly web interface that increases the speed of working with Git.

Inclined to build a profession as GIT Developer? Then here is the blog post on Git Training Course.

Git Commands

Let’s check out some basic Git commands that are used to work with Git. 

    • To check the version of the Git, use the command below
       $ git --version
    • To add a Git username that is to identify the author, use the command below-
       $ git config --global user.name “USERNAME”
    • To verify the username, use the command below
       $ git config --global user.name
    • To set the email address, use the command below-
       $ git config --global user.email “email_address@example.com”
    • To verify the email, use the command below-   
       $ git config --global user.email
    • To add all the files, use the command below-
       $ git add .
    • To view changes in red color and add the file, use the command below-
       $ git add file-name
    • To check the changes made in the file, use the command below-
       $ git status
    • To check the entire information list, use the command below-
       $ git config --global --list
    • To create a new branch, use the command below-
       $ git checkout -b branch-name
    • To switch from one branch to another, use the command below-
       $ git checkout branch-name
    • To pull the latest changes to the master branch, use the command below-
       $ git checkout master
    • To fetch the latest changes to the working directory, use the command below

         Here, NAME-OF-BRANCH might be an existing branch or master branch

    • To send changes to the master branch, use the command below-
       $ git push origin branch-name
    • To delete all changes including untracked files, use the command below-
       $ git clean -f
    • To merge the different branch with the master branch, use the command below-
       $ git checkout branch-name
       $ git merge master

Mindmajix Youtube Channel

How to log in to GitLab?

To log in to the GitLab, do the following steps: 

  1. Open about.gitlab.com
  2. If you have an account, Sign in or else Register.
  3. You will get a Welcome page of GitLab, as shown in the figure.
  4. Click to Create a project where developers work most in GitLab. Here we can create projects, configure projects, and can add files.
  5. Create a group in GitLab helps organize your projects and grants access to multiple projects more quickly if we had dozens of documents on policies and best practices for a developing team.
  6. Explore public projects helps to access a massive library of public GitLab projects. GitLab supports if you want to access public projects to find out how to organize or to grab a copy of open source software and contribute.
  7. Learn more about GitLab helps to access GitLab’s documentation, guides to using the platform. It helps to create a project using CI/CD pipelines. Now, let’s see How to create a project.
Read these latest GitLab Interview Questions that help you grab the high-paying job

How to Create a Project?

To create a project in GitLab, do the following steps:

  1. On the above GitLab welcome, Click on Create a project.
  2. We get a four options page to create a project in GitLab, as shown in the figure.
  3. Firstly, let’s create a Blank project.
  4. Enter the Project name and Enable Private Visibility level, as shown in the figure, and then click Create project.
  5. An empty repository project has been created, as shown in the figure
  6. Now open Git Bash and run the following commands that help to create a Git file, configure the file, add a file, and push the file to the repository.
    • Configure your username, using the command below
      $ git config --global user.name “Keerthana_Jonnalagadda”?
    • Configure your email, using the command below.
      $ git config --global user.email Youremail@address.com?
    • Make a directory by using the command below
      $ mkdir GLTutorial?
    • Configure the directory by using the command below.
      $ cd GLTutorial?
    • Run the command
      $ pwd?
    • You will get an empty folder link representing a folder is created.
      /c/Users/Lenovo/GLTutorial?
    • Now initialize the folder by using the command below.
      $ git init?
    • Now let’s create a file by using the command below
      $ touch Mindmajix.txt?
    • Run a Notepad file by using the command below
      $ notepad Mindmajix.txt?
    • You will get a Notepad file naming Mindmajix. Write a few words in the file, as shown in the figure.
    • Check the status
      $ git status
      
    • Add the file 
      $ git add .?
    • Commit the file
      $ git add .?
    • Check the status
      $ git add .?
    • Now go to GitLab, click Projects dropdown in the menu, and open Your Projects, as shown in the figure.
    • Add remote origin
      $ git remote add origin
      Keerthana_Jonnalagadda/gitlab-tutorial.?
    • Fetch the file
      $ git remote -v?
    • Push the file
      $ git push -u origin master

      7.Open GitLab, check Your projects, and you can see the “Mindmajix.txt” file which is created to push into the GitLab

       as shown in the figure

      Click on the “Mindmajix.txt” file.

      8.You can see the data in the file, as shown in the figure.

      Likewise, we can push our files, folder, and records into GitLab.

Create from Template

  1. We can also create a project using 24 in-built templates of different sources like Ruby on Rails, Spring, iOS Swift, .NET Core, and many more as shown in the figure.
    From the list available in-built templates, click Preview to view the template source and click Use template to start creating the template. Rest the process is the same as creating a blank project.[]

Create from Importing a Project

  1. We can import projects from various Git and other sources to GitLab, as shown in the figure.

Create using CI/CD external repository

  1. Instead of moving the entire project to GitLab, we can connect to an external repository using a CI/CD external repo.
  2. Choose GitHub or Repo by URL to connect with an external repository

How to Create a Group in GitLab?

  1. The group is a collection of projects that helps to manage and organize the projects like a folder. It helps to maintain the group members access and permissions for each project in the group. To create a group, do follow the steps.
  2. Open GitLab, click Groups on the top menu bar, and then click on New group to create a group as shown in the figure
  3. You get a create group page, in that Enter your Group name and click Create group, as shown in the figure.
  4. The group was successfully created. Now, click on New Project to create projects in the group, as shown in the figure.
  5. Enter the project name and enable Private visibility level as shown in the figure
  6. The project Mindmajix is successfully created.
  7. Go back to the groups and check the project is created as in the figure
  8. We can also add an avatar to our project and group name. Open project, click on Settings and then click General as shown in the figure
  9. A general settings page opens. Choose project avatar and select your avatar and click Save changes.
  10. You can see the project avatar is updated.
  11. We can also add an avatar while creating the project.

Add users to the group

Adding users to the group makes an organized work that benefits time to access files. Admin can restrict the access of the user and can even schedule a time for a deadline to work on the project. To add users to the group, do the following steps. 

  1. Open your Group, click on Members in the group’s dashboard
  2. Members page opens, as shown in the figure.
    • Enter GitLab member or Email address to invite into the group.
    • We can choose the role of a particular member such as Guest, Reporter, Developer, Maintainer, and Owner.
    • We can schedule the access expiration data that helps to organize the work in a schedule.
      And then Click Invite to add the member into the group. 
      This way, we can invite members or users to the group.

Changing the owner of the group

The ownership of group members must have at least one owner. Changing the owner of a group is only possible by one owner. To change the owner of the group, do the following steps.

As a current owner

  • Go to groups, click Members in the group dashboard.
  • Assign different user Owner permissions.
  • Have a new owner sign in and remove Owner permission from you(owner).

As an administrator,

  • Go to groups, click Members in the group dashboard.
  • Assign different user Owner permissions.
  • Now refresh the page. We can remove permissions from the original owner.

Remove members from the group

In GitLab, an owner is a person who manages the users of the group. So, only users with the permission of the owner can also manage the group members.
To remove a member from the group, do the following steps:

  1. In the group, click Members in the group dashboard.
  2. Click the Delete button which is next to a group member to remove. A remove member window appears.
  3. Enable Also unassign this user from related issues and merge requests checkbox.
  4. Click Remove member.

Project forking workflow

A fork is a copy of an original repository that we make in the namespace and can apply changes later without affecting the original project. It takes a few steps to fork a project in GitLab.

Create a fork

To create a fork, do the following steps:

  1. On the project page, pick a project and click on the fork icon as shown in the figure
  2. Select the project to create a copy of the project.
  3. The project has been forked successfully.

Request for merging

A Merge Request is a request to merge one branch to another, which means when we create a new feature, change the files, and push into the GitLab; you need to create a merge request. This process helps to update the changes made in the copy file and the original file. To create a merge request, do the following steps.

  1. Open projects, click Merge Requests on the project’s dashboard and then click on New merge.
  2. You will get a Merge page, Select your source branch and click Compare branch and continue.
  3. A New merge request page opens. Give all the required detail to merge and click Submit merge request.
  4. A request has been sent to the person for merging the changes in the project.

Removing a fork 

In GitLab, we can even remove the fork relationship that helps not to send merge requests to the upstream project. Only project owners have permission to remove the fork of a project. To remove a fork, do follows the steps below:

  1. Go to projects, Click on Settings and then click General as shown in the figure.
  2. A General Settings page opens in that list, scroll down to Advanced and click Expand.
  3. An advanced settings page opens in that scroll down to Remove fork relationship and click on it.
  4. A confirmation window appears. Type the project link to proceed and click Confirm.

Conclusion

On winding up, GitLab is a user-friendly and open-source tool that helps to store the file and organize them more easily. It allows developers to coordinate easily to work on the project. GitLab is easy to manage and configure the projects, and it has relied on Git, where the number of users is not restricted and can create more building applications. We have learned the basic details of GitLab, How to create a project, group, and how to fork a project. I hope this tutorial has helped you to understand GitLab.

Job Support Program

Online Work Support for your on-job roles.

jobservice

Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:

  • Pay Per Hour
  • Pay Per Week
  • Monthly
Learn MoreGet Job Support
Course Schedule
NameDates
Git TrainingDec 24 to Jan 08View Details
Git TrainingDec 28 to Jan 12View Details
Git TrainingDec 31 to Jan 15View Details
Git TrainingJan 04 to Jan 19View Details
Last updated: 08 Jan 2024
About Author

Keerthana Jonnalagadda working as a Content Writer at Mindmajix Technologies Inc. She writes on emerging IT technology-related topics and likes to share good quality content through her writings. You can reach her through LinkedIn.

read less