GitLabgitlab-org

cli

main
ply5 git calls25 ms97 KiB3 cachedprotocol v2
195 lines6.5 KiBRaw

Other options to install the GitLab CLI

These installation instructions are either not officially supported by GitLab, or are maintained by the community.

mise-en-place

To manage a glab installation with mise:

  1. Add the following to the [tools] section of a mise configuration file:

    toml
    glab = "latest"
  2. Run mise install.

macOS

  • Homebrew (officially supported)
    • Install with: brew install glab
    • Update with: brew upgrade glab
  • MacPorts:
    • Install with: sudo port install glab
    • Update with: sudo port selfupdate && sudo port upgrade glab
  • ASDF tool version manager:
    • Install with: asdf plugin add glab; asdf install glab latest; asdf global glab latest

Windows

Linux

Homebrew

Installing from Homebrew is the officially supported installation method for Linux.

  • Install with: brew install glab
  • Update with: brew upgrade glab

ASDF

To install with the ASDF tool version manager, run these commands:

shell
asdf plugin add glab; asdf install glab latest; asdf global glab latest

Snapcraft

To install glab from the Snap Store:

  1. Make sure you have snap installed on your Linux distribution.
  2. For the latest stable release: sudo snap install glab
  3. For the latest edge release (updated on every commit to main): sudo snap install --edge glab
  4. Grant glab access to SSH keys: sudo snap connect glab:ssh-keys
  5. Grant glab access to the OS keyring for encrypted credential storage: sudo snap connect glab:password-manager-service. Without this connection, glab auth login falls back to plaintext storage. See credential storage.

![Download from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)

Arch Linux

For Arch Linux, glab is available:

  • From the extra/glab package.
  • By downloading and installing an archive from the releases page.
  • From the Snap Store, if snap is installed.
  • Installing with the package manager: pacman -S glab

Alpine Linux

glab is available on the Alpine Community Repository as glab.

When installing, use --no-cache so no apk update is required:

shell
apk add --no-cache glab
Install a pinned version from edge

To ensure that by default edge is used to get the latest updates. We need the edge repository in /etc/apk/repositories.

Afterwards you can install it with apk add --no-cache glab@edge

We use --no-cache so an apk update is not required.

shell
echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
apk add --no-cache glab@edge
Alpine Linux Docker-way

Use edge directly

shell
FROM alpine:3.13
RUN apk add --no-cache glab

Fetching latest glab version from edge

shell
FROM alpine:3.13
RUN echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
RUN apk add --no-cache glab@edge

Fedora

Fedora users can find glab as glab in the official repositories.

Install it with the command dnf install glab.

Nix/NixOS

Nix (NixOS) users can install from nixpkgs with the command nix-env -iA nixos.glab.

WakeMeOps (Debian/Ubuntu)

glab also exists in the WakeMeOps repository:

shell
# Add WakeMeOps repository
curl -sSL "https://raw.githubusercontent.com/upciti/wakemeops/main/assets/install_repository" | sudo bash

# Install glab
sudo apt install glab

Spack

  • To install: spack install glab.
  • To update: spack uninstall glab && spack install glab

Docker

A Docker image for glab is available at gitlab/glab:

shell
docker pull gitlab/glab

GitLab CI/CD

To use glab in a CI/CD pipeline, you must set the entrypoint of the image to the glab executable itself. For more information, see the GitLab documentation for Override the entrypoint of an image. An example .gitlab-ci.yml:

Example .gitlab-ci.yml:

yaml
example:
  stage: test
  image:
    name: "gitlab/glab"
    entrypoint: [""]
  script:
    - glab --version

Shell completions

If your shell is not supported by glab completion, you can use Carapace-bin to get completions for glab and other CLI tools. To set up completions for your shell, follow the Carapace-bin installation instructions.

1---
2stage: AI Clients
3group: Developer Clients
4info: To determine the technical writer assigned to the Stage/Group associated with this page, see <https://handbook.gitlab.com/handbook/marketing/product-and-technical-marketing/technical-writing/#assignments>
5---
7# Other options to install the GitLab CLI
9These installation instructions are either not officially supported by GitLab, or
10are maintained by the community.
12## mise-en-place
14To manage a `glab` installation with `mise`:
161. Add the following to the `[tools]` section of a `mise`
17 [configuration file](https://mise.jdx.dev/configuration.html):
19 ```toml
20 glab = "latest"
21 ```
231. Run `mise install`.
25## macOS
27- Homebrew (officially supported)
28 - Install with: `brew install glab`
29 - Update with: `brew upgrade glab`
30- [MacPorts](https://ports.macports.org/port/glab/details/):
31 - Install with: `sudo port install glab`
32 - Update with: `sudo port selfupdate && sudo port upgrade glab`
33- [ASDF tool version manager](https://asdf-vm.com/guide/introduction.html):
34 - Install with: `asdf plugin add glab; asdf install glab latest; asdf global glab latest`
36## Windows
38- Homebrew (through [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install)) (officially supported)
39 - Install with: `brew install glab`
40 - Update with: `brew upgrade glab`
41- [WinGet](https://github.com/microsoft/winget-cli)
42 - Install with: `winget install glab.glab`
43 - Update with: `winget install glab.glab`
44- [Chocolatey](https://chocolatey.org)
45 - Install with: `choco install glab`
46 - Update with: `choco upgrade glab`
47- [scoop](https://scoop.sh)
48 - Install with: `scoop install glab`
49 - Update with: `scoop update glab`
50- [ASDF tool version manager](https://asdf-vm.com/guide/introduction.html):
51 - Requires [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/install).
52 - Install with: `asdf plugin add glab; asdf install glab latest; asdf global glab latest`
53- Download an EXE installer or the `glab.exe` binary from the [releases page](https://gitlab.com/gitlab-org/cli/-/releases)
55## Linux
57- Download prebuilt binaries from the [releases page](https://gitlab.com/gitlab-org/cli/-/releases)
59### Homebrew
61Installing from Homebrew is the officially supported installation method for Linux.
63- Install with: `brew install glab`
64- Update with: `brew upgrade glab`
66### ASDF
68To install with the [ASDF tool version manager](https://asdf-vm.com/guide/introduction.html), run these commands:
70```shell
71asdf plugin add glab; asdf install glab latest; asdf global glab latest
72```
74### Snapcraft
76To install `glab` from the [Snap Store](https://snapcraft.io/glab):
781. Make sure you have [snap installed](https://snapcraft.io/docs/installing-snapd) on your Linux distribution.
791. For the latest stable release: `sudo snap install glab`
801. For the latest edge release (updated on every commit to `main`): `sudo snap install --edge glab`
811. Grant `glab` access to SSH keys: `sudo snap connect glab:ssh-keys`
821. Grant `glab` access to the OS keyring for encrypted credential storage: `sudo snap connect glab:password-manager-service`. Without this connection, `glab auth login` falls back to plaintext storage. See [credential storage](source/authentication.md#credential-storage).
84[![Download from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/glab)
86### Arch Linux
88For Arch Linux, `glab` is available:
90- From the [`extra/glab`](https://archlinux.org/packages/extra/x86_64/glab/) package.
91- By downloading and installing an archive from the
92 [releases page](https://gitlab.com/gitlab-org/cli/-/releases).
93- From the [Snap Store](https://snapcraft.io/glab), if
94 [snap](https://snapcraft.io/docs/installing-snap-on-arch-linux) is installed.
95- Installing with the package manager: `pacman -S glab`
97### Alpine Linux
99`glab` is available on the [Alpine Community Repository](https://git.alpinelinux.org/aports/tree/community/glab?h=master) as `glab`.
101When installing, use `--no-cache` so no `apk update` is required:
103```shell
104apk add --no-cache glab
105```
107#### Install a pinned version from edge
109To ensure that by default edge is used to get the latest updates. We need the edge repository in `/etc/apk/repositories`.
111Afterwards you can install it with `apk add --no-cache glab@edge`
113We use `--no-cache` so an `apk update` is not required.
115```shell
116echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
117apk add --no-cache glab@edge
118```
120#### Alpine Linux Docker-way
122Use edge directly
124```shell
125FROM alpine:3.13
126RUN apk add --no-cache glab
127```
129Fetching latest glab version from edge
131```shell
132FROM alpine:3.13
133RUN echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
134RUN apk add --no-cache glab@edge
135```
137### Fedora
139Fedora users can find `glab` as `glab` in the official repositories.
141Install it with the command `dnf install glab`.
143### Nix/NixOS
145Nix (NixOS) users can install from [nixpkgs](https://search.nixos.org/packages?channel=unstable&show=glab&from=0&size=30&sort=relevance&query=glab) with the command `nix-env -iA nixos.glab`.
147### WakeMeOps (Debian/Ubuntu)
149`glab` also exists in the [WakeMeOps repository](https://docs.wakemeops.com/packages/glab/):
151```shell
152# Add WakeMeOps repository
153curl -sSL "https://raw.githubusercontent.com/upciti/wakemeops/main/assets/install_repository" | sudo bash
155# Install glab
156sudo apt install glab
157```
159### Spack
161- To install: `spack install glab`.
162- To update: `spack uninstall glab && spack install glab`
164## Docker
166A Docker image for `glab` is available at
167[`gitlab/glab`](https://hub.docker.com/r/gitlab/glab/):
169```shell
170docker pull gitlab/glab
171```
173### GitLab CI/CD
175To use `glab` in a CI/CD pipeline, you must set the `entrypoint` of the image to
176the `glab` executable itself. For more information, see the GitLab documentation
177for [Override the entrypoint of an image](https://docs.gitlab.com/ci/docker/using_docker_images/#override-the-entrypoint-of-an-image). An example `.gitlab-ci.yml`:
179Example `.gitlab-ci.yml`:
181```yaml
182example:
183 stage: test
184 image:
185 name: "gitlab/glab"
186 entrypoint: [""]
187 script:
188 - glab --version
189```
191## Shell completions
193If your shell is not supported by [`glab completion`](source/completion/_index.md), you can
194use [Carapace-bin](https://github.com/carapace-sh/carapace-bin) to get completions for `glab`
195and other CLI tools. To set up completions for your shell, follow the [Carapace-bin installation instructions](https://carapace-sh.github.io/carapace-bin/install.html).
Diagnostics5 git calls · 25 ms
CallStatusSizeTime025 ms
discover200185 B4 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=185
git.server.agent=git/2.56.g1891de4-Linux
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch server-option object-format
git.server.fetch=shallow wait-for-done filter
git.protocol.version=2
git.pkt.frames=9
git.pkt.data=7
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=185
git.pkt.payload.max=35
ls-refs20058 KiB3 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=59849
git.response.cache=UPDATING
git.response.duration_ms=3
git.protocol.version=2
git.pkt.frames=731
git.pkt.data=730
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=59849
git.pkt.payload.max=143
git.ls_refs.count=730
git.ls_refs.head=refs/heads/main
fetchcombine:blob:none+tree:2 · deepen 12004.2 KiB · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=4273
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=combine:blob:none+tree:2
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=1
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=7
git.pkt.data=5
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=4273
git.pkt.payload.max=4173
git.sideband.band1.bytes=4173
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=11
git.pack.bytes=4173
git.fetch.wide.objects=11
git.fetch.wide.extra_bytes=3930
git.fetch.wide.blobs=0
fetchtree:0 · deepen 1020032 KiB · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=19
git.response.bytes=32926
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=tree:0
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=22
git.pkt.data=20
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=32926
git.pkt.payload.max=32046
git.sideband.band1.bytes=32046
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=80
git.pack.bytes=32046
git.pack.ofs_delta=36
git.pack.ref_delta=0
git.pack.chain.max=2
git.pack.trailer=cb0bad5d7ffc514895d8b21c4dd470327f90bc91
git.pack.full=44
Open pack map
fetch2002.4 KiB · hit19 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=2443
git.response.cache=HIT
git.response.duration_ms=19
git.fetch.wants=5f008739d7b3cc80197fcd85d77fd26a384f6579
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=2443
git.pkt.payload.max=2416
git.sideband.band1.bytes=2416
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://gitlab.com/gitlab-org/cli
Ref
refs/heads/main
Commit
0dd7574dce9e385c5c30540e6c15657adc6bdce9
cf-ray
a5e10cdf0f23910d
Request
464644ab…
Protocol
v2 · sha1
Agent
git/2.56.g1891de4-Linux
Filter
advertised
Fetch
shallow wait-for-done filter
Capabilities
agent ls-refs fetch server-option object-format