glab(1)
π
glab-artifact-registry-login β the glab(1) glow-up
okay bestie, sit down, we're doing the glab manual page and honestly? it's giving "niche but iconic." this one's the glab-artifact-registry-login command: Authenticate a package manager against the GitLab Artifact Registry. and yes, it's marked (EXPERIMENTAL) β we'll get to that, don't worry π«Ά
β¨ SYNOPSIS β¨
glab artifact-registry login [flags]
πΈ DESCRIPTION πΈ
so what this does: it configures a package manager to authenticate against the GitLab Artifact Registry, and it does it using a short-lived access token that it exchanges from your GitLab session. cute, right? one session, temp token, no long-term secrets lying around (well. mostly. keep reading).
you pick your package manager with the flag β that's the whole vibe:
--docker: registersglabas a Docker credential helper for the registry. set it and forget it energy.--maven: writes a<server>block in~/.m2/settings.xml, or in whatever you pass with--config-file, keyed by--registry-alias. you reference it from a<repository>carrying the same<id>. β οΈ the token is written in plain text, so keep a--config-fileout of version control. like, fr fr, don't commit it.--gradle: writes{alias}Url,{alias}Username, and{alias}Passwordin~/.gradle/gradle.properties, where{alias}is--registry-alias.--npm: writes a//{host}{path}/:_authTokenentry in~/.npmrc. that's not the whole story though β you still need to point npm at the registry, with aregistry=or@scope:registry=line.--yarn: writes annpmRegistriesentry withnpmAuthTokenandnpmAlwaysAuthin~/.yarnrc.yml, for Yarn 2 and later. set annpmRegistryServerthat matches--registry. heads up: rewriting the file can change its formatting β indentation, blank lines, line endings, all of it π.--sbt: writes acredentials +=line in~/.sbt/1.0/credentials.sbt, which sbt 1.x reads, and the same line in2/credentials.sbtin the sbt 2.x global base, which sbt 2.x reads. that base is~/.config/sbt, or%LOCALAPPDATA%\sbton Windows, unlessSBT_CONFIG_HOMEorXDG_CONFIG_HOMEmoves it. on Windows it also writes%LOCALAPPDATA%\sbt\credentials.sbt. thesbt.batof sbt 2.x points every build it starts, on either version, at that file only β even whenSBT_CONFIG_HOMEis set. thesbt.versionin a project'sproject/build.propertiesdecides which file its build reads. an sbt started with any other-Dsbt.global.basereads none of them π. and an sbt shell or sbt 2.x server that's already running keeps the credentials it loaded, so runreloadin it, orsbt shutdown, after you log in. to write a different file, pass it with--config-file. it must be a.sbtfile that sbt loads β not a properties file such as~/.sbt/.credentials.
π token lifetime
--dockerexchanges a fresh token on every pull or push, so--durationdoes not apply. main character behavior honestly.- every other flag writes one token, and nothing refreshes it. run the command again before
--durationelapses. the default is15minutes and the maximum is12hours. set a reminder bestie π
π¦ credential resolution
- Docker runs the credential helper as its own subprocess, which reads your credentials from the configuration file and ignores
GITLAB_TOKEN. this command verifies the login the same way, so runglab auth loginfirst if no token is stored for the host. - every other flag does read
GITLAB_TOKEN.glabwrites the token into each file itself, so the tool can read it without fetching credentials itself.
π registry and alias selection
- use
--registryonly for a registry the Artifact Registry actually backs. if you name a container registry here, it receives the wrong token and the error only surfaces on the next pull. like, it will not tell you immediately. it's a jumpscare. --registry-aliasapplies to--mavenand--gradleonly, because--npm,--sbt, and--yarnkey their entries on--registryitself. for--gradle, use an alias that is a valid identifier in your build script: the default is derived from the registry host and contains hyphens, which Groovy cannot interpolate as${...}.
π¨ this feature is an experiment and is not ready for production use. it might be unstable or removed at any time. for more information, see https://docs.gitlab.com/policy/development_stages_support/.
π OPTIONS π
--config-file=""β file to write (Maven/sbt only). defaults to~/.m2/settings.xmlfor--mavenand the sbt 1.x and 2.x global bases for--sbt, where it replaces every file--sbtwrites.--docker[=false]β configure Docker to authenticate against the registry. writes to$DOCKER_CONFIG, or~/.dockerwhen it is unset.--duration=15m0sβ how long the exchanged token should remain valid. ignored for--docker.--gradle[=false]β configure Gradle to authenticate against the registry. writes to~/.gradle/gradle.properties.--hostname=""β GitLab hostname to request the token from. defaults to the configured GitLab instance.--maven[=false]β configure Maven to authenticate against the registry. writes to~/.m2/settings.xml.--npm[=false]β configure npm to authenticate against the registry. writes to~/.npmrc.--registry=""β registry to authenticate against. for--docker, a bare hostname; for others, typically a URL.--registry-alias=""β alias/ID to register the registry under (Maven/Gradle only). defaults to a name derived from--registry.--sbt[=false]β configure sbt to authenticate against the registry. writescredentials.sbtto the sbt 1.x and 2.x global bases.--yarn[=false]β configure Yarn 2 or later to authenticate against the registry. writes to~/.yarnrc.yml. for Yarn 1, use--npm.
π OPTIONS INHERITED FROM PARENT COMMANDS π
-h,--help[=false]β show help for this command. the classic.
β EXAMPLE β
# Configure Docker to authenticate against a registry
glab artifact-registry login --docker --registry registry.example.com
# Configure Maven to authenticate against a registry for two hours
glab artifact-registry login --maven --registry https://ar.example.com --duration 2h
# Configure Gradle to authenticate against a registry for two hours
glab artifact-registry login --gradle --registry https://ar.example.com --duration 2h
# Configure npm to authenticate against a registry for two hours
glab artifact-registry login --npm --registry https://ar.example.com --duration 2h
# Configure Yarn 2 or later to authenticate against a registry for two hours
glab artifact-registry login --yarn --registry https://ar.example.com --duration 2h
# Configure sbt to authenticate against a registry for two hours
glab artifact-registry login --sbt --registry https://ar.example.com --duration 2h
# Configure Maven through a settings.xml passed to mvn with -s
glab artifact-registry login --maven --registry https://ar.example.com --config-file ~/.m2/ci-settings.xml
π§ SEE ALSO π§
glab-artifact-registry(1) β go read that one next, iykyk π
that's the whole page bestie, hope it ate β¨ auto generated by spf13/cobra, dated Nov 2026, and this was glab(1) β mwah π
π
π¦ where this page comes from
- arch rolling: glab 1.128.0-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms