Search for a command to run...
A comprehensive guide for installing and configuring GitLab CLI (glab) on different operating systems
GitLab CLI (glab
) is an open source GitLab CLI tool that brings GitLab to your terminal. It allows you to manage GitLab operations directly from the command line, reducing context switching between the browser and terminal.
# Download the latest .deb package
curl -LO "https://gitlab.com/gitlab-org/cli/-/releases/download/v$(curl -s "https://gitlab.com/api/v4/projects/gitlab-org%2Fcli/releases" | grep tag_name | head -n 1 | cut -d'"' -f4)/glab_$(curl -s "https://gitlab.com/api/v4/projects/gitlab-org%2Fcli/releases" | grep tag_name | head -n 1 | cut -d'"' -f4)_linux_amd64.deb"
# Install the package
sudo dpkg -i glab_*_linux_amd64.deb
After installing GitLab CLI, authenticate with your GitLab account:
# Start the login process
glab auth login
# Follow the interactive prompts to:
# 1. Enter your GitLab instance URL (default: https://gitlab.com)
# 2. Enter your personal access token
# 3. Choose your preferred protocol (HTTPS or SSH)
Verify the installation by checking the GitLab CLI version:
glab --version
# Clone a repository
glab repo clone owner/repo
# Create a new repository
glab repo create [name]
# Fork a repository
glab repo fork [repository]
# View repository
glab repo view [repository]
# Create an issue
glab issue create
# List issues
glab issue list
# View an issue
glab issue view [issue-number]
# Close an issue
glab issue close [issue-number]
# Create a merge request
glab mr create
# List merge requests
glab mr list
# Check out a merge request locally
glab mr checkout [mr-number]
# View a merge request
glab mr view [mr-number]
# View pipeline status
glab pipeline list
# View pipeline logs
glab pipeline ci view
# Trigger a pipeline
glab pipeline run
Authentication Failed
Command Not Found
API Rate Limiting
GitLab CLI respects several environment variables:
# Set default GitLab host
export GITLAB_HOST="gitlab.com"
# Set personal access token
export GITLAB_TOKEN="your-token"
# Set default editor
export EDITOR="vim"
GitLab CLI configuration is stored in ~/.config/glab-cli/config.yml
:
# Example configuration
hosts:
gitlab.com:
token: your-token
git_protocol: ssh
gitlab.example.com:
token: your-enterprise-token
git_protocol: https