GitLab CLI (glab)

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

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 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

Install the CLI

Installation instructions are available in the GLab README.

Authenticate with GitLab

GLab supports multiple authentication methods including OAuth and personal access tokens. To get started, run glab auth login and follow the interactive setup.

For detailed authentication instructions, see the Authentication section in the main README.

Environment Variables

VariableDescription
BROWSERThe web browser to use for opening links. Can be set in the config with ‘glab config set browser mybrowser’.
DEBUGSet to true to output more logging information, including underlying Git commands, expanded aliases and DNS error details.
FORCE_HYPERLINKSSet to true to force hyperlinks in output, even when not outputting to a TTY.
GITLAB_CLIENT_IDProvide custom ‘client_id’ generated by GitLab OAuth 2.0 application. Defaults to the ‘client-id’ for GitLab.com.
GITLAB_HOST or GL_HOSTIf GitLab Self-Managed or GitLab Dedicated, specify the URL of the GitLab server. (Example: https://gitlab.example.com) Defaults to https://gitlab.com.
GITLAB_TOKENAn authentication token for API requests. Set this variable to avoid prompts to authenticate. Overrides any previously-stored credentials. Can be set in the config with ‘glab config set token xxxxxx’.
GLAB_CHECK_UPDATESet to true to force an update check. By default the cli tool checks for updates once a day.
GLAB_CONFIG_DIRSet to a directory path to override the global configuration location.
GLAB_DEBUG_HTTPSet to true to output HTTP transport information (request / response).
GLAB_SEND_TELEMETRYSet to false to disable telemetry being sent to your GitLab instance. Can be set in the config with ‘glab config set telemetry false’. See https://docs.gitlab.com/administration/settings/usage_statistics/ for more information
GLAMOUR_STYLEThe environment variable to set your desired Markdown renderer style. Available options: dark, light, notty. To set a custom style, read https://github.com/charmbracelet/glamour#styles
NO_COLORSet to any value to avoid printing ANSI escape sequences for color output.
NO_PROMPTSet to true to disable prompts.
REMOTE_ALIAS or GIT_REMOTE_URL_VARA ‘git remote’ variable or alias that contains the GitLab URL. Can be set in the config with ‘glab config set remote_alias origin’.
VISUAL, EDITOR (in order of precedence)The editor tool to use for authoring text. Can be set in the config with ‘glab config set editor vim’.

Options

  -h, --help      Show help for this command.
  -v, --version   show glab version information

Commands

Report issues

Open an issue in the gitlab-org/cli repository to send us feedback.