LinuxCommandLibrary

glab

Interact with GitLab from the command line

TLDR

Clone a GitLab repository locally

$ glab repo clone [owner]/[repository]
copy

Create a new issue
$ glab issue create
copy

View and filter the open issues of the current repository
$ glab issue list
copy

View an issue in the default browser
$ glab issue view [[-w|--web]] [issue_number]
copy

Create a merge request
$ glab mr create
copy

View a pull request in the default web browser
$ glab mr view [[-w|--web]] [pr_number]
copy

Check out a specific pull request locally
$ glab mr checkout [pr_number]
copy

SYNOPSIS

glab [global options] <command> [<args>]

PARAMETERS

-R, --repo <REPOSITORY>
    Select repository in <group>/<project> format (default: current repo)

-g, --group <GROUP>
    Select group by path or ID ($GLAB_GROUP)

--page-size, -p <int>
    Items per page (default 20, max 100)

--paginate
    Keep fetching pages until all items retrieved

--help, -h
    Show help for command

--version, -v
    Print glab version

DESCRIPTION

glab is an open-source command-line tool that brings GitLab functionality directly to your terminal, enabling seamless interaction with GitLab instances for repositories, issues, merge requests, pipelines, and more.

It supports common workflows like cloning repos (glab repo clone), listing and creating issues (glab issue list, glab issue create), managing merge requests (glab mr create, glab mr approve), viewing CI/CD pipelines (glab pipeline list), and project settings.

Authentication leverages Git credentials or personal access tokens via glab auth login. No browser needed for most operations. Highly scriptable, extensible with plugins, and mirrors GitHub's gh CLI for familiar usage.

Ideal for CI/CD automation, terminal enthusiasts, and teams preferring CLI over web UI. Supports self-hosted GitLab too.

CAVEATS

Some actions require specific GitLab permissions (e.g., maintainer for MR approval). Rate-limited by GitLab API. Self-hosted instances need API endpoint config.

AUTHENTICATION

Run glab auth login for token/SSH/OAuth setup; auto-detects Git creds.

SUBCOMMANDS

Core: repo, issue, mr, ci, project. List with glab --help.

INSTALLATION

Via brew install glab, apt, or GitLab releases. Supports aliases like alias git=glab.

HISTORY

Developed by GitLab community; first release v1.0 in 2020. Now official tool with 20k+ stars on GitHub, active contributions, and regular updates aligning with GitLab features.

SEE ALSO

git(1), gh(1), hub(1)

Copied to clipboard