feat(kb/gitlab): start article about gitlab cli

This commit is contained in:
Michele Cereda
2025-03-26 18:37:09 +01:00
parent 7d3b421525
commit ae68aca253
2 changed files with 95 additions and 0 deletions

View File

@@ -828,6 +828,7 @@ Solution: set the correct ownership with
- [Upgrade Path tool]
- [Elasticsearch]
- [CODEOWNERS syntax]
- [GitLab CLI][glab]
### Sources
@@ -871,6 +872,7 @@ Solution: set the correct ownership with
<!-- Knowledge base -->
[buildah]: ../buildah.md
[glab]: glab.md
[kaniko]: ../kaniko.md
[self-hosting]: ../self-hosting.md

View File

@@ -0,0 +1,93 @@
# GitLab CLI
The `glab` utility is a CLI tool for GitLab.
Available for repositories hosted on GitLab.com, GitLab Dedicated, and GitLab Self-Managed.<br/>
Supports multiple authenticated GitLab instances.<br/>
Automatically detects the authenticated hostname from the remotes available in one's working Git directory.
1. [TL;DR](#tldr)
1. [Further readings](#further-readings)
## TL;DR
<details>
<summary>Setup</summary>
```sh
# Install.
brew install 'glab'
# Start interactive configuration.
glab auth login
# Load shell completions.
glab completion -s 'fish' > "$HOME/.config/fish/completions/glab.fish"
source <(glab completion -s 'bash')
```
Global configuration file: `~/.config/glab-cli/config.yml`.<br/>
Repository-specific configuration file: `.git/glab-cli/config.yml`<br/>
They contain tokens in plaintext.
</details>
<details>
<summary>Usage</summary>
```sh
# Get help.
glab --help
glab user --help
glab release view --help
# Make changes to the configuration.
glab config edit
glab config edit --local
glab config set 'host' 'gitlab.example.org' --global
glab config set 'git_protocol' 'ssh' --host 'gitlab.example.org'
glab config set 'api_protocol' 'https' -h 'gitlab.example.org'
glab config set 'editor' 'vim'
glab config set 'token' 'xxxxx' -h 'gitlab.com'
glab config set 'check_update' 'false' --global
# Clone repositories.
glab repo clone 'someGroup/someRepo'
# List issues.
glab issues list
glab issues list --repo 'someGroup/someNamespace/someRepo'
# List Merge Requests.
glab mr list
glab mr list --repo 'someGroup/someNamespace/someRepo'
```
</details>
<!-- Uncomment if used
<details>
<summary>Real world use cases</summary>
```sh
```
</details>
-->
## Further readings
- [Codebase]
<!--
Reference
═╬═Time══
-->
<!-- In-article sections -->
<!-- Knowledge base -->
<!-- Files -->
<!-- Upstream -->
[codebase]: https://gitlab.com/gitlab-org/cli
<!-- Others -->