cli

module
v1.117.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2026 License: MIT

README

GLab

GLab

GLab is an open source GitLab CLI tool. It brings GitLab to your terminal, next to where you are already working with git and your code, without switching between windows and browser tabs. While it's powerful for issues and merge requests, glab does even more:

  • View, manage, and retry CI/CD pipelines directly from your CLI.
  • Create changelogs.
  • Create and manage releases.
  • Ask GitLab Duo Chat (Classic) questions about Git.
  • Manage GitLab agents for Kubernetes.

glab is available for repositories hosted on GitLab.com, GitLab Dedicated, and GitLab Self-Managed. It supports multiple authenticated GitLab instances, and automatically detects the authenticated hostname from the remotes available in your working Git directory.

command example

Table of contents

Requirements

glab officially supports GitLab versions 16.0 and later. Certain commands might require more recent versions. While many commands might work properly in GitLab versions 15.x and earlier, no support is provided for these versions.

Usage

To get started with glab:

  1. Follow the installation instructions appropriate for your operating system.
  2. Authenticate into your instance of GitLab.
  3. Optional. Configure glab further to meet your needs:

You're ready!

Commands

Run glab --help to view a list of core commands in your terminal.

Commands follow this pattern:

glab <command> <subcommand> [flags]

Many core commands also have sub-commands. Some examples:

  • List merge requests assigned to you: glab mr list --assignee=@me
  • List review requests for you: glab mr list --reviewer=@me
  • Approve a merge request: glab mr approve 235
  • Create an issue, and add milestone, title, and label: glab issue create -m release-2.0.0 -t "My title here" --label important
GitLab Duo for the CLI

The GitLab CLI also includes support for using the GitLab Duo Agent Platform directly in your terminal.

Use glab duo cli to ask GitLab Duo questions about your codebase and to autonomously perform actions on your behalf.

For more information, see GitLab Duo CLI.

Demo

asciicast

Documentation

Read the documentation for usage instructions or check out glab help.

Installation

Download a binary suitable for your OS at the releases page. Other installation methods depend on your operating system.

Homebrew

Homebrew is the officially supported package manager for macOS, Linux, and Windows (through Windows Subsystem for Linux)

  • Homebrew
    • Install with: brew install glab
    • Update with: brew upgrade glab
Other installation methods

Other options to install the GitLab CLI that may not be officially supported or are maintained by the community are also available.

Building from source

If a supported binary for your OS is not found at the releases page, you can build from source:

Prerequisites for building from source

To build from source:

  1. Run go version to verify that you have the minimum required Go version. If Go is not installed, see Download and install.
  2. Clone the repository: git clone https://gitlab.com/gitlab-org/cli.git
  3. Build the binary: make build
  4. Install glab in $GOPATH/bin: make install
  5. Optional. If $GOPATH/bin or $GOBIN is not in your $PATH, run export PATH=$PWD/bin:$PATH.
  6. Confirm the installation: glab version

Authentication

To authenticate glab with OAuth, a personal access token, or a CI job token, see Authenticate with GitLab.

Configuration

For configuration levels, the configuration search order, and platform-specific file locations, see Configure the CLI.

For connecting to a GitLab Self-Managed or GitLab Dedicated instance, and for mTLS and self-signed certificates, see Connect to your GitLab instance.

For authenticating proxies, including custom HTTP headers and Google Identity-Aware Proxy, see Connect through a proxy.

Environment variables

glab reads its configuration from environment variables as well as the configuration file. Every configuration key has a matching variable, and the variable wins over the stored value. Setting them centrally is a good way to give everyone in an organization the same setup.

For the full reference, see Environment variables. For how glab picks which token to use, see Token precedence.

Debugging

When the GLAB_DEBUG environment variable is set to true, glab outputs more logging information, including:

  • Underlying Git commands.
  • Expanded aliases.
  • DNS error details.

Troubleshooting

For help with common authentication issues, see Troubleshooting in the GitLab CLI documentation.

Issues

If you have an issue: report it on the issue tracker

Security

To report a security vulnerability in glab, follow the process in the security policy. Please do not open a public issue.

To learn how the project handles dependency updates and container-scanner CVE reports, see dependency management and reporting a vulnerability in CONTRIBUTING.md.

Contributing

Feel like contributing? That's awesome! We have a contributing guide and Code of conduct to help guide you.

When updating command help text or documentation, follow the GitLab CLI documentation style guide.

Versioning

This project follows the SemVer specification.

Classify version changes
  • If deleting a command, changing how it behaves, or adding a new required flag, the release must use a new MAJOR revision.
  • If adding a new command or optional flag, the release must use a new MINOR revision.
  • If fixing a bug, the release must use a new PATCH revision.
Compatibility

We do our best to introduce breaking changes only when releasing a new MAJOR version. Unfortunately, there are situations where this is not possible, and we may introduce a breaking change in a MINOR or PATCH version. Some of situations where we may do so:

  • If a security issue is discovered, and the solution requires a breaking change, we may introduce such a change to resolve the issue and protect our users.
  • If a feature was not working as intended, and the bug fix requires a breaking change, the bug fix may be introduced to ensure the functionality works as intended.
  • When feature behavior is overwhelmingly confusing due to a vague specification on how it should work. In such cases, we may refine the specification to remove the ambiguity, and introduce a breaking change that aligns with the refined specification. For an example of this, see merge request 1382.
  • Experimental features are not guaranteed to be stable, and can be modified or removed without a breaking change.

Breaking changes are a last resort, and we try our best to only introduce them when absolutely necessary.

Inspiration

The GitLab CLI was adopted from Clement Sam in 2022 to serve as the official CLI of GitLab. Over the years the project has been inspired by both the GitHub CLI and Zaq? Wiedmann's lab.

Lab has served as the foundation for many of the GitLab CI/CD commands including ci view and ci trace.

Directories

Path Synopsis
cmd
gen-docs command
glab command
internal
api
This is a silly wrapper for gitlab client-go but helps maintain consistency
This is a silly wrapper for gitlab client-go but helps maintain consistency
api/artifactregistry
Package artifactregistry provides a client for exchanging a GitLab session token for a short-lived GitLab Artifact Registry access token via the POST /api/v4/token_exchange endpoint.
Package artifactregistry provides a client for exchanging a GitLab session token for a short-lived GitLab Artifact Registry access token via the POST /api/v4/token_exchange endpoint.
binarymgr
Package binarymgr provides a reusable lifecycle for managed CLI binaries distributed through a GitLab project's Generic Package Registry.
Package binarymgr provides a reusable lifecycle for managed CLI binaries distributed through a GitLab project's Generic Package Registry.
cmdutils
This file implements URL parsing for GitLab resources to allow commands to accept full GitLab URLs instead of just resource IDs.
This file implements URL parsing for GitLab resources to allow commands to accept full GitLab URLs instead of just resource IDs.
commands/artifactregistry/gettoken
Package gettoken implements `glab artifact-registry get-token`, which exchanges the caller's GitLab credential for a short-lived GitLab Artifact Registry access token.
Package gettoken implements `glab artifact-registry get-token`, which exchanges the caller's GitLab credential for a short-lived GitLab Artifact Registry access token.
commands/artifactregistry/login
Package login implements `glab artifact-registry login`, which authenticates a package manager against the GitLab Artifact Registry.
Package login implements `glab artifact-registry login`, which authenticates a package manager against the GitLab Artifact Registry.
commands/artifactregistry/status
Package status implements `glab artifact-registry status`, which reports the caller's access to the GitLab Artifact Registry by exchanging their GitLab session for a short-lived access token and inspecting its claims.
Package status implements `glab artifact-registry status`, which reports the caller's access to the GitLab Artifact Registry by exchanging their GitLab session for a short-lived access token and inspecting its claims.
commands/auth/docker
Package docker provides commands that help configure a docker credential helper.
Package docker provides commands that help configure a docker credential helper.
commands/ci/legacyci
This package contains the old `glab pipeline ci` command which has been deprecated in favour of the `glab ci` command.
This package contains the old `glab pipeline ci` command which has been deprecated in favour of the `glab ci` command.
commands/mr/diff
adapted from https://github.com/cli/cli/blob/trunk/pkg/cmd/pr/diff/diff.go
adapted from https://github.com/cli/cli/blob/trunk/pkg/cmd/pr/diff/diff.go
commands/skills/bundled
Package bundled is the source for agent skills that ship inside the glab binary via go:embed.
Package bundled is the source for agent skills that ship inside the glab binary via go:embed.
commands/skills/registry
Package registry is the aggregate skill registry — it stitches together every source of skills (bundled, remote) and exposes a single surface for `glab skills list` and `glab skills install` to consume.
Package registry is the aggregate skill registry — it stitches together every source of skills (bundled, remote) and exposes a single surface for `glab skills list` and `glab skills install` to consume.
commands/skills/remote
Package remote is the source for agent skills hosted on gitlab.com and listed in this repo's curated registry.
Package remote is the source for agent skills hosted on gitlab.com and listed in this repo's curated registry.
commands/skills/skill
Package skill defines the shared types used by every source of glab agent skills (bundled, remote, etc.).
Package skill defines the shared types used by every source of glab agent skills (bundled, remote, etc.).
dbg
dependencyfirewall/fsx
Package fsx contains small filesystem helpers shared across the dependency-firewall packages.
Package fsx contains small filesystem helpers shared across the dependency-firewall packages.
dependencyfirewall/pm
Package pm runs a supported package manager (npm, pip, gem, ...) behind the Dependency Firewall's local MITM proxy.
Package pm runs a supported package manager (npm, pip, gem, ...) behind the Dependency Firewall's local MITM proxy.
dependencyfirewall/policy
Package policy decides whether a package coordinate is allowed by the GitLab Dependency Firewall.
Package policy decides whether a package coordinate is allowed by the GitLab Dependency Firewall.
dependencyfirewall/purl
Package purl parses Package URL (PURL) strings into the subset the Dependency Firewall check command supports: npm, pypi, maven, and gem.
Package purl parses Package URL (PURL) strings into the subset the Dependency Firewall check command supports: npm, pypi, maven, and gem.
diff
Package diff parses unified diff text to build line mappings.
Package diff parses unified diff text to build line mappings.
dockercredhelper
Package dockercredhelper wires glab into Docker as a credential helper: it installs the docker-credential-glab shim that Docker executes, and points Docker's config.json at that shim for a set of registry domains.
Package dockercredhelper wires glab into Docker as a credential helper: it installs the docker-credential-glab shim that Docker executes, and points Docker's config.json at that shim for a set of registry domains.
fsx
Package fsx contains small filesystem helpers for callers that need a write to land at a forced permission mode, atomically where the platform allows it: a token-bearing file that must not stay world-readable, or an executable shim that must never be observed in a non-executable state.
Package fsx contains small filesystem helpers for callers that need a write to land at a forced permission mode, atomically where the platform allows it: a token-bearing file that must not stay world-readable, or an executable shim that must never be observed in a non-executable state.
git
git/testing
Package testing is a generated GoMock package.
Package testing is a generated GoMock package.
mcpannotations
Package mcpannotations defines constants for MCP command annotations
Package mcpannotations defines constants for MCP command annotations
run
testing/artifactregistrytest
Package artifactregistrytest provides shared test helpers for internal/api/artifactregistry and the commands built on top of it, so their tests don't each redefine the same fake token_exchange server and fake JWT.
Package artifactregistrytest provides shared test helpers for internal/api/artifactregistry and the commands built on top of it, so their tests don't each redefine the same fake token_exchange server and fake JWT.
testing/cmdtest
Package cmdtest is a generated GoMock package.
Package cmdtest is a generated GoMock package.
testing/gittest
Package gittest is a generated GoMock package.
Package gittest is a generated GoMock package.
upload
Package upload uploads local files to a project and returns the markdown references that embed them in an issue, merge request, or note.
Package upload uploads local files to a project and returns the markdown references that embed them in an issue, merge request, or note.
scripts
skills/add-remote command
Add (or update) a curated remote skill entry in internal/commands/skills/remote/registry.yaml.
Add (or update) a curated remote skill entry in internal/commands/skills/remote/registry.yaml.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL