Cli
Read only mirror of https://gitlab.com/gitlab-org/cli
Install / Use
/learn @gitlabhq/CliREADME
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.

Table of contents
- Requirements
- Usage
- Demo
- Documentation
- Installation
- Authentication
- Configuration
- Environment variables
- Troubleshooting
- Issues
- Contributing
- Inspiration
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:
- Follow the installation instructions appropriate for your operating system.
- Authenticate into your instance of GitLab.
- Optional. Configure
glabfurther to meet your needs:- 1Password users can configure it to authenticate to
glab. - Set any needed global, per-project, or per-host configuration.
- Set any needed environment variables.
- 1Password users can configure it to authenticate to
You're ready!
Core commands
Run glab --help to view a list of core commands in your terminal.
glab alias: Create, list, and delete aliases.glab api: Make authenticated requests to the GitLab API.glab auth: Manage the authentication state of the CLI.glab changelog: Interact with the changelog API.glab check-update: Check for updates to the CLI.glab ci: Work with GitLab CI/CD pipelines and jobs.glab cluster: Manage GitLab agents for Kubernetes and their clusters.glab completion: Generate shell completion scripts.glab config: Set and get CLI settings.glab deploy-key: Manage deploy keys.glab duo: Generate terminal commands from natural language.glab gpg-key: Manage GPG keys registered with your GitLab account.glab incident: Work with GitLab incidents.glab issue: Work with GitLab issues.glab iteration: Retrieve iteration information.glab job: Work with GitLab CI/CD jobs.glab label: Manage labels for your project.glab mcp: Work with a Model Context Protocol (MCP) server. (EXPERIMENTAL)glab milestone: Manage group or project milestones.glab mr: Create, view, and manage merge requests.glab opentofu: Work with the OpenTofu or Terraform integration.glab release: Manage GitLab releases.glab repo: Work with GitLab repositories and projects.glab schedule: Work with GitLab CI/CD schedules.glab securefile: Manage secure files for a project.glab snippet: Create, view and manage snippets.glab ssh-key: Manage SSH keys registered with your GitLab account.glab stack: Create, manage, and work with stacked diffs.glab token: Manage personal, project, or group tokens.glab user: Interact with a GitLab user account.glab variable: Manage variables for a GitLab project or group.glab version: Show version information for the CLI.
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 provides support for GitLab Duo AI/ML powered features. These include:
Use glab duo ask to ask GitLab Duo (Classic) questions about git commands. It can help you
remember a command you forgot, or provide suggestions on how to run commands to perform other tasks.
To interact with the GitLab Duo Agent Platform, use the GitLab Duo CLI.
A unified experience is proposed in issue 585937.
Demo
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
- Install with:
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
make- Go version as defined by
main/go.mod
To build from source:
- Run
go versionto verify that you have the minimum required Go version. If Go is not installed, see Download and install. - Clone the repository:
git clone https://gitlab.com/gitlab-org/cli.git - Build the binary:
make build - Install
glabin$GOPATH/bin:make install - Optional. If
$GOPATH/binor$GOBINis not in your$PATH, runexport PATH=$PWD/bin:$PATH. - Confirm the installation:
glab version
Authentication
When running glab auth login interactively inside a Git repository, glab automatically
detects GitLab instances from your Git remotes and presents them as options. This saves you
from having to manually type the hostname.
OAuth (GitLab.com)
To authenticate your installation of glab with an OAuth application connected to GitLab.com:
- Start interactive setup with
glab auth login. - For the GitLab instance you want to sign in to, select GitLab.com.
- For the login method, select Web. This selection launches your web browser to request authorization for the GitLab CLI to use your GitLab.com account.
- Select Authorize.
- Complete the authentication process in your terminal, selecting the appropriate options for your needs.
OAuth (GitLab Self-Managed, GitLab Dedicated)
Prerequisites:
- You've created an OAuth application at the user, group, or instance level, and you have its application ID. For instructions, see how to configure GitLab as an OAuth 2.0 authentication identity provider in the GitLab documentation.
- Your OAuth application is configured with these parameters:
- Redirect URI is
http://localhost:7171/auth/redirect. - *Confidential
- Redirect URI is
