gitlab cli tool
Table of Content
gitlab cli tool¶
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
# Linux_x86_64 for linux and wsl2
# macOS_arm64 for macosx
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
upgrade¶
cd ~/dnld
curl -LO https://gitlab.com/gitlab-org/cli/-/releases/v1.45.0/downloads/glab_1.45.0_Linux_x86_64.tar.gz
mkdir glab_1.45
tar zxvf glab_1.45.0_Linux_x86_64.tar.gz -C glab_1.45
mv glab_1.45/bin/glab ~/.local/bin/.
glab --version
authentication¶
Use GitLab OAuth 2.0. Navigate to user settings page on GitLab and add a new application.
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