---
title: GitLab CLI (glab)
stage: Create
group: Code Review
info: To determine the technical writer assigned to the Stage/Group associated with this page, see <https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments>
---

<!--
This documentation is auto generated by a script.
Please do not edit this file directly. Run `make gen-docs` instead.
-->

{{< details >}}

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

{{< /details >}}

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](img/getting-started.gif)

## Install the CLI

Installation instructions are available in the GLab
[`README`](https://gitlab.com/gitlab-org/cli/#installation).

## 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](https://gitlab.com/gitlab-org/cli#authentication)
in the main README.

## Pagination

Commands that return lists of items are paginated. Use `--page` and `--per-page` to
navigate results. These commands respect the pagination limits configured on your
GitLab instance.

## Environment Variables

<!-- markdownlint-disable MD044 MD034 -->

| Variable | Description |
|----------|-------------|
| `BROWSER` | The web browser to use for opening links. Can be set in the config with `glab config set browser mybrowser`. |
| `GITLAB_CLIENT_ID` | Provide custom `client_id` generated by GitLab OAuth 2.0 application. Defaults to the `client-id` for GitLab.com. |
| `GITLAB_HOST or GL_HOST` | If GitLab Self-Managed or GitLab Dedicated, specify the URL of the GitLab server. (Example: `https://gitlab.example.com`) Defaults to `https://gitlab.com`. |
| `GITLAB_TOKEN` | An 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_UPDATE` | Set to true to force an update check. By default the cli tool checks for updates once a day. |
| `GLAB_CONFIG_DIR` | Set to a directory path to override the global configuration location. |
| `GLAB_DEBUG_HTTP` | Set to true to output HTTP transport information (request / response). |
| `GLAB_SEND_TELEMETRY` | Set 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 |
| `NO_COLOR` | Set to any value to avoid printing ANSI escape sequences for color output. |
| `REMOTE_ALIAS or GIT_REMOTE_URL_VAR` | A `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`. |
| `GLAB_DEBUG` | Set to true to output more logging information, including underlying Git commands, expanded aliases and DNS error details. |
| `GLAB_ENABLE_CI_AUTOLOGIN` | Set to `true` to enable auto-login in GitLab CI. CI auto-login detects if glab is running in a GitLab CI job by checking the predefined CI/CD variable `GITLAB_CI`. If detected, it uses predefined CI/CD variables such as `CI_SERVER_FQDN` and `CI_JOB_TOKEN` to sign in, and ignores host variables like `GITLAB_HOST`. If `GITLAB_TOKEN`, `GITLAB_ACCESS_TOKEN`, or `OAUTH_TOKEN` are set, they take precedence over `CI_JOB_TOKEN`. Only glab commands that support `CI_JOB_TOKEN` work with CI auto-login. For a list of supported commands, see <https://docs.gitlab.com/ci/jobs/ci_job_token/#job-token-access>. |
| `GLAB_FORCE_HYPERLINKS` | Set to true to force hyperlinks in output, even when not outputting to a TTY. |
| `GLAB_GLAMOUR_STYLE` | The 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> |
| `GLAB_NO_PROMPT` | Set to true (or 1) to disable prompts, or false (or 0) to enable them. |
| `GLAB_SHOW_WHATS_NEW` | Set to false to suppress the one-time post-upgrade banner that points at `glab whatsnew` when a new version is detected. Can be set in the config with `glab config set show_whats_new false`. |

<!-- markdownlint-enable MD044 MD034 -->

## Options

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

## Commands

- [`glab alias`](alias/_index.md)
- [`glab api`](api/_index.md)
- [`glab attestation`](attestation/_index.md)
- [`glab auth`](auth/_index.md)
- [`glab changelog`](changelog/_index.md)
- [`glab check-update`](check-update/_index.md)
- [`glab ci`](ci/_index.md)
- [`glab cluster`](cluster/_index.md)
- [`glab completion`](completion/_index.md)
- [`glab config`](config/_index.md)
- [`glab container-registry`](container-registry/_index.md)
- [`glab deploy-key`](deploy-key/_index.md)
- [`glab duo`](duo/_index.md)
- [`glab gpg-key`](gpg-key/_index.md)
- [`glab incident`](incident/_index.md)
- [`glab issue`](issue/_index.md)
- [`glab iteration`](iteration/_index.md)
- [`glab job`](job/_index.md)
- [`glab label`](label/_index.md)
- [`glab mcp`](mcp/_index.md)
- [`glab milestone`](milestone/_index.md)
- [`glab mr`](mr/_index.md)
- [`glab opentofu`](opentofu/_index.md)
- [`glab orbit`](orbit/_index.md)
- [`glab packages`](packages/_index.md)
- [`glab release`](release/_index.md)
- [`glab repo`](repo/_index.md)
- [`glab runner`](runner/_index.md)
- [`glab runner-controller`](runner-controller/_index.md)
- [`glab schedule`](schedule/_index.md)
- [`glab search`](search/_index.md)
- [`glab securefile`](securefile/_index.md)
- [`glab security`](security/_index.md)
- [`glab skills`](skills/_index.md)
- [`glab snippet`](snippet/_index.md)
- [`glab ssh-key`](ssh-key/_index.md)
- [`glab stack`](stack/_index.md)
- [`glab todo`](todo/_index.md)
- [`glab token`](token/_index.md)
- [`glab user`](user/_index.md)
- [`glab variable`](variable/_index.md)
- [`glab version`](version/_index.md)
- [`glab whatsnew`](whatsnew/_index.md)
- [`glab work-items`](work-items/_index.md)

## Troubleshooting

When working with `glab`, you might encounter the following issues.

### Error: `invalid_client` during OAuth login

When authenticating with an OAuth application, `glab auth login` might fail with an error:

```plaintext
Oauth2: "invalid_client" "Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method.".
```

This happens when the OAuth application has the **Confidential** option enabled. `glab` is a
public client and cannot keep a client secret, so it authenticates without one. Confidential
applications require a client secret, which causes GitLab to reject the request.

To resolve this issue, edit your OAuth application and clear the **Confidential** checkbox.

After saving the change, run `glab auth login` again. For the full list of required application
settings, see the [OAuth (GitLab Self-Managed, GitLab Dedicated)](https://gitlab.com/gitlab-org/cli#oauth-gitlab-self-managed-gitlab-dedicated)
section in the main README.

## Report issues

Open an issue in the [`gitlab-org/cli` repository](https://gitlab.com/gitlab-org/cli/issues/new)
to send us feedback.
