What is GitLab?
Overview of GitLab
GitLab is a complete DevOps platform that helps developers manage source code, collaborate with teams, and automate software delivery. It is built on top of Git, a distributed version control system, and provides additional features like CI/CD, issue tracking, and security scanning.
GitLab allows teams to manage the entire software development lifecycle from a single interface — from planning and coding to testing, deployment, and monitoring.
Key features of GitLab
Some of the most important features of GitLab include:
- Source Code Management (SCM): Host and manage Git repositories
- CI/CD Pipelines: Automate build, test, and deployment processes
- Merge Requests: Review and collaborate on code changes
- Issue Tracking: Track bugs, features, and tasks
- Security Scanning: Built-in tools for vulnerability detection
- Container Registry: Store Docker images securely
- Wiki & Documentation: Maintain project documentation
Git vs GitLab (Key Differences)
What is Git?
Git is a distributed version control system used to track changes in source code. You can start with Git basics and workflow. It allows multiple developers to work on the same project independently and merge their changes later.
With Git, developers can (see Git command cheat sheet for quick reference):
- Track file changes
- Create branches
- Merge code
- Revert to previous versions
Git works locally on your system and does not require a server.
What is GitLab?
GitLab is a web-based platform that uses Git as its core technology and adds powerful features like repository hosting, CI/CD pipelines, collaboration tools, and DevOps automation.
Unlike Git, GitLab provides:
- Remote repository hosting
- Web interface for managing code
- Team collaboration tools
- Automation pipelines
Git vs GitLab comparison table
| Feature | Git | GitLab |
|---|---|---|
| Type | Version Control System | DevOps Platform |
| Hosting | No (local only) | Yes (cloud & self-hosted) |
| UI | Command-line | Web-based UI + CLI |
| Collaboration | Limited | Advanced (merge requests, issues) |
| CI/CD | Not included | Built-in CI/CD pipelines |
| Usage | Track code changes | Manage entire DevOps lifecycle |
Types of GitLab (SaaS vs Self-Hosted)
GitLab SaaS (cloud version)
GitLab SaaS is the cloud-hosted version available at gitlab.com. It is managed by GitLab and requires no installation.
Advantages:
- No setup or maintenance required
- Accessible from anywhere
- Automatic updates and backups
Best for:
- Beginners
- Small to medium teams
- Quick project setup
GitLab self-hosted (GitLab CE/EE)
Self-hosted GitLab allows you to install GitLab on your own server using GitLab Community Edition (CE) or Enterprise Edition (EE).
Advantages:
- Full control over data and infrastructure
- Custom security and compliance settings
- Suitable for enterprise environments
Best for:
- Organizations with strict security requirements
- Large teams and enterprises
- Custom DevOps workflows
When to use each option
- Use GitLab SaaS if you want a quick, hassle-free setup with minimal maintenance.
- Use self-hosted GitLab if you need full control, customization, and enhanced security.
Choosing the right option depends on your project size, security needs, and infrastructure requirements.
Pre-requisites
System requirements
Before getting started with GitLab, ensure your system meets the following requirements:
- A Linux-based system (Ubuntu, CentOS, RHEL, etc.)
- Internet connectivity
- Basic knowledge of terminal commands
- A GitLab account (we will create one in the next step)
Install Git on Linux
Git must be installed on your system to interact with GitLab repositories. Refer to create Git repository and setup basics if you are new.
For Debian/Ubuntu:
sudo apt update
sudo apt install git -yFor RHEL/CentOS:
sudo yum install git -yVerify installation:
git --versionStep 1: Create a GitLab Account
Sign up on GitLab
- Navigate to https://gitlab.com
- Click on Register
- Enter your email, username, and password
- Follow the on-screen instructions
Verify email and login
- Check your email inbox for a verification link
- Click the link to activate your account
- Log in to GitLab using your credentials
Basic account setup
After logging in:
- Set your profile name and preferences
- Configure timezone and notifications (optional)
- Explore the dashboard
Step 2: Generate and Configure SSH Keys
Why SSH keys are required
SSH keys provide secure authentication between your system and GitLab without requiring a password every time. You can also follow a detailed guide on setting up GitLab with VS Code.
Benefits:
- Secure communication
- No need to enter credentials repeatedly
- Faster Git operations
Generate SSH key using ssh-keygen
Run the following command to generate an SSH key:
ssh-keygen -t ed25519 -C "your_email@example.com"Press Enter to accept the default file location and optionally set a passphrase.
Add SSH key to GitLab account
Display your public key:
cat ~/.ssh/id_ed25519.pubCopy the output and follow these steps:
- Go to GitLab dashboard
- Click on Profile → Preferences → SSH Keys
- Paste the key into the text box
- Click Add key
Test SSH connection
Verify your SSH connection with GitLab:
ssh -T git@gitlab.comIf successful, you will see a welcome message from GitLab.
Step 3: Create Your First GitLab Project
Create a new project in GitLab
- Log in to your GitLab account
- Click on New Project
- Select Create blank project
- Enter project name and description
- Choose visibility (Public/Private)
- Click Create project
Public vs private repositories
- Public repository: Anyone can view the code and files
- Private repository: Only authorized users can access the project
Choose based on your use case and security needs.
Initialize repository with README
While creating the project, you can choose to initialize it with a README.md file.
Benefits:
- Provides project description
- Helps users understand the purpose of the repository
- Improves documentation and usability
After creation, your repository is ready for development and collaboration.
Step 4: Clone GitLab Repository to Local System
Clone using SSH
After creating your project, you need to clone it to your local system.
- Go to your GitLab project
- Click on Clone
- Select Clone with SSH and copy the URL
Run the following command in your terminal (see more in git clone examples):
git clone git@gitlab.com:username/project-name.gitReplace username and project-name with your actual details.
Verify cloned repository
Navigate into the cloned directory:
cd project-nameList the files to confirm:
ls -lIf the repository contains a README or other files, they will appear here.
Step 5: GitLab Workflow Explained
What is staging in Git?
Staging is the process of preparing changes before committing them. It allows you to selectively include files in the next commit. Learn more in git add and staging concepts.
Example:
git add file.txtWhat is commit?
A commit is a snapshot of your changes saved in the Git repository. See git commit message best practices.
Example:
git commit -m "Add new file"What is branching?
Branching allows you to create separate lines of development without affecting the main codebase. Refer to git branch examples
Example:
git switch -c feature-branchWhat is merge request?
A merge request (MR) is a request to merge changes from one branch into another (usually into main). It allows code review and collaboration.
What is merging?
Merging combines changes from one branch into another. See git merge examples.
Example:
git merge feature-branchStep 6: Manage GitLab Project Using CLI
In this section, we will manage a GitLab project using the command line interface (CLI). This is the most common and efficient way developers interact with GitLab repositories in real-world scenarios.
You will learn how to create branches, add files, stage changes, commit updates, merge code, and push changes to the remote GitLab repository. These are the core Git operations that form the foundation of any GitLab workflow.
Create and switch branch
Create a new branch and switch to it (see git switch command). This helps you work on features or changes without affecting the main branch.
git switch -c new-branchCreate files in repository
Create a new file inside your repository.
touch file.txtStage changes
Add the file to the staging area so it can be included in the next commit (learn more in git add and unstage files):
git add file.txtCommit changes
Save your changes with a meaningful commit message (see git commit amend examples):
git commit -m "Add file.txt"Merge branch to main
Switch to the main branch and merge your changes (compare merge vs rebase):
git checkout main
git merge new-branchPush changes to GitLab
Upload your changes to the remote GitLab repository (see git push examples):
git push origin mainStep 7: Manage GitLab Project Using GitLab GUI
Create branch using GUI
- Open your project in GitLab
- Click on the branch dropdown
- Select New branch
- Enter branch name and click Create branch
Create and edit files
- Click on Repository → Files
- Click New file
- Add file name and content
Commit changes using GUI
Scroll down and:
- Add a commit message
- Select target branch
- Click Commit changes
Create merge request
- Go to Merge Requests
- Click New merge request
- Select source and target branches
- Click Create merge request
Merge changes in GitLab
- Review the merge request
- Click Merge
- Confirm the merge
Your changes will now be merged into the target branch.
Frequently Asked Questions
1. How do I get started with GitLab?
To get started with GitLab, create an account, generate SSH keys, create a project, and start managing code using Git commands or the GitLab GUI.2. Is GitLab free to use?
Yes, GitLab offers a free SaaS version as well as a self-hosted Community Edition for managing repositories and CI/CD workflows.3. What is the difference between Git and GitLab?
Git is a distributed version control system used to track changes in code, while GitLab is a platform that hosts Git repositories and provides additional DevOps features.4. How do I create my first project in GitLab?
You can create a project by signing in to GitLab, clicking on New Project, entering project details, and initializing a repository.5. Do I need SSH keys for GitLab?
SSH keys are recommended for secure authentication and allow you to push and pull code without entering your username and password repeatedly.Summary
In this guide, you learned how to get started with GitLab step by step. We covered:
- Understanding what GitLab is and how it differs from Git
- Creating a GitLab account and configuring SSH keys
- Creating your first GitLab project
- Cloning repositories to your local system
- Understanding GitLab workflow (staging, commit, branching, merging)
- Managing projects using both CLI and GitLab GUI
GitLab is a powerful platform that combines version control with DevOps capabilities, making it easier to collaborate, automate workflows, and manage projects efficiently.
With regular practice, you can move beyond basics and explore advanced topics like git rebase, git stash usage, and git reflog recovery.


