glab-auth
Skill1 starsChanged 7 months agoMITView on GitHub
Manage GitLab CLI authentication including login/logout, check auth status, switch accounts, and configure Docker registry access. Use when setting up glab for first time, troubleshooting auth issues, switching GitLab instances/accounts, or configuring Docker to pull from GitLab registry. Triggers on auth, login, logout, authentication, credentials, token, Docker registry.
- Reads credentials
We split this skill into the rules it gives an agent
22 rules. About 0 are common, 9 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 35
Follow prompts for your GitLab instance
- Very specific: line 63
CI auto-login (GA in v1.90.0): when enabled, token environment variables such as GITLAB_TOKEN, GITLAB_ACCESS_TOKEN, or OAUTH_TOKEN still …
- Distinctive: line 67
If you need different agents to show up as different GitLab users, use distinct GitLab bot/service accounts.
- Distinctive: line 69
Use the Actor identity for actor-authored GitLab comments, replies, approvals, and other writes.
- Very specific: line 79
Keep these env files outside version control, restrict their permissions (for example chmod 600), be mindful of backup exposure, and prefer …
- Very specific: line 81
If the file uses plain KEY=value lines, load it with exported vars before running glab:
- Very specific: line 93
if glab cannot see the env token, it may silently fall back to shared stored auth in ~/.config/glab-cli/config.yml
- Distinctive: line 94
if another env file was sourced earlier in the same shell/session, identity can be sticky in ways that are unsafe for writes unless you …
- Very specific: line 100
Run this immediately before any GitLab write, including glab mr note, review submission or approval, thread replies, and any glab api …
- Distinctive: line 111
If a comment or reply was posted under the wrong identity:
- Distinctive: line 114
Delete the mistaken comment or reply if cleanup is needed.
- Distinctive: line 119
Verify the thread no longer shows the wrong visible author for the replacement message.
- Distinctive: line 161
Verify token hasn't expired (check GitLab settings)
- Very specific: line 165
If you switched from browser/OAuth login to token-based login and glab still appears to use stale stored credentials, run glab auth login …
- Very specific: line 166
After re-login, verify with glab auth status before retrying the failing command.
- Very specific: line 169
If GITLAB_TOKEN, GITLAB_ACCESS_TOKEN, or OAUTH_TOKEN is exported, it overrides stored credentials.
- Distinctive: line 170
If auth suddenly fails, check whether an env token is being picked up before assuming your saved login is broken.
- Very specific: line 172
Verify the active actor and token path with glab auth status and glab api user before any GitLab write.
- Very specific: line 176
Use --hostname flag to specify instance
- Very specific: line 181
Check Docker config: cat ~/.docker/config.json
- Very specific: line 182
Verify helper is set: "credHelpers": { "registry.gitlab.com": "glab-cli" }
- Very specific: line 197
After authentication, see glab-config to set CLI defaults
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
glab auth
Manage GitLab CLI authentication.
Quick start
# Interactive login
glab auth login
# Browser/OAuth login without the prompt (v1.90.0+)
glab auth login --hostname gitlab.com --web
# Check current auth status
glab auth status
# Login to different instance
glab auth login --hostname gitlab.company.com
# Logout
glab auth logoutWorkflows
First-time setup
- Run
glab auth login - Choose authentication method (token or browser)
- Follow prompts for your GitLab instance
- Verify with
glab auth status
v1.90.0+:
glab auth loginsupports a more complete setup flow:
--ssh-hostnameto explicitly set a different SSH endpoint for self-hosted instances--webto skip the login-type prompt and go straight to browser/OAuth auth--container-registry-domainsto preconfigure registry / dependency-proxy domains during loginExample: API hostname
gitlab.company.com, SSH hostnamessh.company.com
v1.90.0 Login Flag Examples
# Self-managed GitLab with separate API and SSH endpoints
glab auth login \
--hostname gitlab.company.com \
--ssh-hostname ssh.company.com
# Skip prompts and go straight to browser/OAuth auth
glab auth login --hostname gitlab.com --web
# Preconfigure multiple registry / dependency proxy domains during login
glab auth login \
--hostname gitlab.com \
--web \
--container-registry-domains "registry.gitlab.com,gitlab.com"CI auto-login (GA in v1.90.0): when enabled, token environment variables such as GITLAB_TOKEN, GITLAB_ACCESS_TOKEN, or OAUTH_TOKEN still take precedence over stored credentials and CI_JOB_TOKEN.
Agentic and multi-account setups
If you need different agents to show up as different GitLab users, use distinct GitLab bot/service accounts. Multiple PATs on one GitLab user are useful for rotation or scope separation, but they do not create distinct visible identities.
Use the Actor identity for actor-authored GitLab comments, replies, approvals, and other writes. Use an agent identity only when the GitLab action is explicitly that agent's own work product. Pick the intended visible actor before the first write.
A good operational pattern is one env file per actor:
# ~/.config/openclaw/env/gitlab-reviewer.env
GITLAB_TOKEN=glpat-...
GITLAB_HOST=gitlab.comKeep these env files outside version control, restrict their permissions (for example chmod 600), be mindful of backup exposure, and prefer least-privilege bot/service-account tokens. In a reused shell, clear stale GitLab auth vars first or start a fresh shell.
If the file uses plain KEY=value lines, load it with exported vars before running glab:
unset GITLAB_TOKEN GITLAB_ACCESS_TOKEN OAUTH_TOKEN GITLAB_HOST
set -a
source ~/.config/openclaw/env/gitlab-<actor>.env
set +aWhy this matters:
- plain
sourcedoes not necessarily export variables to child processes glabonly sees env vars that are exported- if
glabcannot see the env token, it may silently fall back to shared stored auth in~/.config/glab-cli/config.yml - if another env file was sourced earlier in the same shell/session, identity can be sticky in ways that are unsafe for writes unless you deliberately switch and verify
That fallback/shared-auth behavior is convenient for humans, but in multi-agent automation it can cause the wrong GitLab account to post comments, create MRs, or approve work.
Required pre-flight before any GitLab write
Run this immediately before any GitLab write, including glab mr note, review submission or approval, thread replies, and any glab api POST/PATCH/PUT/DELETE call:
glab auth status --hostname "$GITLAB_HOST"
glab api --hostname "$GITLAB_HOST" userThis assumes the target actor env file set GITLAB_HOST for the exact GitLab instance you intend to modify. Do not write until both commands clearly show the intended visible actor on that host.
Wrong-identity remediation
If a comment or reply was posted under the wrong identity:
- Stop posting.
- Delete the mistaken comment or reply if cleanup is needed.
unset GITLAB_TOKEN GITLAB_ACCESS_TOKEN OAUTH_TOKEN GITLAB_HOSTor start a fresh shell.- Source the correct env file with
set -a; source ...; set +a. - Rerun
glab auth status --hostname "$GITLAB_HOST"andglab api --hostname "$GITLAB_HOST" user. - Repost under the correct actor.
- Verify the thread no longer shows the wrong visible author for the replacement message.
If the wrong-identity write changed state beyond a comment or reply, re-auth as above and then use the matching GitLab reversal for that write under the correct actor and host, such as unapproving an MR or issuing the compensating glab api --hostname "$GITLAB_HOST" mutation for the exact resource that was changed.
Switching accounts/instances
- Logout from current:
glab auth logout - Login to new instance:
glab auth login --hostname gitlab.company.com - Verify:
glab auth status --hostname gitlab.company.com
Docker registry access
- Configure Docker helper:
glab auth configure-docker - Verify Docker can authenticate:
docker login registry.gitlab.com - Pull private images:
docker pull registry.gitlab.com/group/project/image:tag
Troubleshooting
"401 Unauthorized" errors:
- Check status:
glab auth status - Verify token hasn't expired (check GitLab settings)
- Re-authenticate:
glab auth login
Re-login still looks stuck after changing auth method (v1.92.0):
- If you switched from browser/OAuth login to token-based login and
glabstill appears to use stale stored credentials, runglab auth loginagain instead of assuming the config must be edited manually. - After re-login, verify with
glab auth statusbefore retrying the failing command.
Env-token auth failures (v1.91.0 troubleshooting):
- If
GITLAB_TOKEN,GITLAB_ACCESS_TOKEN, orOAUTH_TOKENis exported, it overrides stored credentials. - If auth suddenly fails, check whether an env token is being picked up before assuming your saved login is broken.
- These failures can affect both read operations and writes, not just write pre-flight checks.
- Verify the active actor and token path with
glab auth statusandglab api userbefore any GitLab write. - In multi-agent shells, deliberately re-source the intended env file with
set -a; source ...; set +abefore retrying.
Multiple instances:
- Use
--hostnameflag to specify instance - Each instance maintains separate auth
Docker authentication fails:
- Re-run:
glab auth configure-docker - Check Docker config:
cat ~/.docker/config.json - Verify helper is set:
"credHelpers": { "registry.gitlab.com": "glab-cli" }
Subcommands
See references/commands.md for detailed flag documentation:
login- Authenticate with GitLab instancelogout- Log out of GitLab instancestatus- View authentication statusconfigure-docker- Configure Docker to use GitLab registrydocker-helper- Docker credential helperdpop-gen- Generate DPoP token
Related Skills
Initial setup:
- After authentication, see
glab-configto set CLI defaults - See
glab-ssh-keyfor SSH key management - See
glab-gpg-keyfor commit signing setup
Repository operations:
- See
glab-repofor cloning repositories - Authentication required before first clone/push
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 2
- vince-winkintel/gitlab-cli-skills★ 4929% same
- cormacc/dotagents★ 160% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository52 other files it gives its agents.
- gh-cliSkill
- glab-aliasSkill
- glab-apiSkill
- glab-attestationSkill
- glab-changelogSkill
- glab-check-updateSkill
- glab-ciSkill
- glab-clusterSkill
- glab-completionSkill
- glab-configSkill
- glab-deploy-keySkill
- glab-duoSkill
- glab-gpg-keySkill
- glab-helpSkill
- glab-incidentSkill
- glab-issueSkill
- glab-iterationSkill
- glab-jobSkill
- glab-labelSkill
- glab-mcpSkill
- glab-milestoneSkill
- glab-mrSkill
- glab-opentofuSkill
- glab-quick-actionsSkill
- glab-releaseSkill
- glab-repoSkill
- glab-runner-controllerSkill
- glab-runnerSkill
- glab-scheduleSkill
- glab-securefileSkill
- glab-snippetSkill
- glab-ssh-keySkill
- glab-stackSkill
- glab-todoSkill
- glab-tokenSkill
- glab-userSkill
- glab-variableSkill
- glab-versionSkill
- glab-workitemsSkill
- gitlab-cli-skillsSkill
- ui-color-palette-audit-paletteSkill
- ui-color-palette-build-color-systemSkill
- ui-color-palette-figmaSkill
- ui-color-palette-framerSkill
- ui-color-palette-generate-codeSkill
- ui-color-palette-generate-semantic-codeSkill
- ui-color-palette-generate-source-colorsSkill
- ui-color-palette-helpSkill
- ui-color-palette-manage-palettesSkill
- ui-color-palette-penpotSkill
- ui-color-palette-scale-paletteSkill
- ui-color-palette-sketchSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

