How to install gitlab CLI

Liam·2025년 2월 26일

Environment Set-Up

목록 보기
2/3

glab is an open-source CLI tool that allows you to interact with GitLab directly from your terminal.


Why Use glab?

Using glab, you can:

  • List, view, and create Merge Requests
  • Manage Issues
  • Clone repositories
  • Automate GitLab workflows
  • Merge, rebase, and approve MRs directly from the terminal

This is especially useful for developers and DevOps engineers who frequently work with GitLab.


Installation Methods for Ubuntu/Debian

There are several ways to install glab on Debian-based systems. Below are the most reliable methods:

This is one of the easiest ways to install glab using a package manager.

# Add the WakeMeOps repository
curl -sSL "https://raw.githubusercontent.com/upciti/wakemeops/main/assets/install_repository" | sudo bash

# Install glab
sudo apt install glab

After installation, verify the version:

glab --version

2. Install via Prebuilt-MPR Repository

If you prefer using a prebuilt .deb package instead of compiling from source, follow these steps:

# Add the Prebuilt-MPR repository
wget -qO - 'https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | gpg --dearmor | sudo tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null

echo "deb [arch=all,$(dpkg --print-architecture) signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $(lsb_release -cs)" | sudo tee /etc/apt/sources.list.d/prebuilt-mpr.list

# Update package lists
sudo apt update

# Install glab
sudo apt install glab

After installation, check the version:

glab --version

3. Install from Source via Makedeb (Advanced Users)

If you want to compile glab from source, use makedeb:

git clone 'https://mpr.makedeb.org/glab'
cd glab/
makedeb -si

This method ensures you have the latest version but requires additional dependencies.


How to Use glab

Once installed, you can authenticate and start using glab.

Login to GitLab

glab auth login
  • Select gitlab.com (or your self-hosted GitLab instance).
  • Enter your Personal Access Token (which can be generated from GitLab under Settings → Access Tokens).

List Open Merge Requests

glab mr list

View a Specific Merge Request

glab mr view <MR-ID>

Example:

glab mr view 42

Merge a Merge Request

glab mr merge <MR-ID>

List Issues

glab issue list

Reference

https://docs.gitlab.com/editor_extensions/gitlab_cli/#install-the-cli
https://gitlab.com/gitlab-org/cli/#installation
https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md#linux
https://docs.makedeb.org/prebuilt-mpr/getting-started/#setting-up-the-repository

profile
System Software Engineer

0개의 댓글