Skip to content




gitlab cli tool


Table of Content

gitlab cli tool

https://gitlab.com/gitlab-org/cli#:~:text=GLab%20is%20an%20open%20source,between%20windows%20and%20browser%20tabs

GLab is an open source GitLab CLI tool bringing GitLab to your terminal next to where you are already working with git and your code without switching between windows and browser tabs. Work with issues, merge requests, watch running pipelines directly from your CLI among other features.

installation

Find the latest release from the release page.

https://gitlab.com/gitlab-org/cli/-/releases

cd ~/dnld
curl -LO https://gitlab.com/gitlab-org/cli/-/releases/v1.40.0/downloads/glab_1.40.0_Linux_x86_64.tar.gz
mv bin/glab ~/.local/bin/.
glab --version

authentication

Use GitLab OAuth 2.0.

https://docs.gitlab.com/ee/integration/oauth_provider.html

  • redirect URL: http://localhost:7171/auth/redirect
  • confidential: not set
  • scopes:
    • openid
    • profile
    • read_user
    • write_repository
    • api

Get application ID and secret. Run below and select web when prompted for the authentication method, open web link provided and authorize.

glab config set client_id {application_id} --host cp.blink-1x52.net
glab auth login --hostname cp.blink-1x52.net

configuration

Global configuration is available at ~/.config/glab-cli/config.yml.

# editor
glab config set --global editor nvim

# default gitlab host
glab config set -g host https://cp.blink-1x52.net

example

# list available issues
glab issue list

# add note to the existing issue #1
glab issue note 1  # ENTER to proceed to text editor to modify note/comment including /spent and other slash commands

# list pipeline history
glab ci list

# show pipeline log
glab ci status

# view pipeline trace
glab ci trace