.nh .TH "glab" "1" "Sep 2026" "Auto generated by spf13/cobra" "" .SH NAME glab-artifact-registry-login - Authenticate a package manager against the GitLab Artifact Registry. (EXPERIMENTAL) .SH SYNOPSIS \fBglab artifact-registry login [flags]\fP .SH DESCRIPTION Configure a package manager to authenticate against the GitLab Artifact Registry, using a short-lived access token exchanged from your GitLab session. .PP Use the flag for your package manager: .IP \(bu 2 \fB--docker\fR: registers \fBglab\fR as a Docker credential helper for the registry. .IP \(bu 2 \fB--maven\fR: writes a \fB\fR block in \fB~/.m2/settings.xml\fR, keyed by \fB--registry-alias\fR\&. Reference it from a \fB\fR carrying the same \fB\fR\&. .IP \(bu 2 \fB--gradle\fR: writes \fB{alias}Url\fR, \fB{alias}Username\fR, and \fB{alias}Password\fR in \fB~/.gradle/gradle.properties\fR, where \fB{alias}\fR is \fB--registry-alias\fR\&. .IP \(bu 2 \fB--npm\fR: writes a \fB//{host}{path}/:_authToken\fR entry in \fB~/.npmrc\fR\&. You still need to point npm at the registry, with a \fBregistry=\fR or \fB@scope:registry=\fR line. .IP \(bu 2 \fB--sbt\fR: writes a \fBcredentials +=\fR line in \fB~/.sbt/1.0/credentials.sbt\fR, which assumes a stock sbt 1.x. An sbt that moved its global base, with \fB-Dsbt.global.base\fR or a newer default, does not read that file. .PP Token lifetime: .IP \(bu 2 \fB--docker\fR exchanges a fresh token on every pull or push, so \fB--duration\fR does not apply. .IP \(bu 2 Every other flag writes one token, and nothing refreshes it. Run the command again before \fB--duration\fR elapses. The default is 15 minutes and the maximum is 12 hours. .PP Credential resolution: .IP \(bu 2 Docker runs the credential helper as its own subprocess, which reads your credentials from the configuration file and ignores \fBGITLAB_TOKEN\fR\&. This command verifies the login the same way, so run \fBglab auth login\fR first if no token is stored for the host. .IP \(bu 2 Every other flag does read \fBGITLAB_TOKEN\fR\&. \fBglab\fR writes the token into each file itself, so the tool can read it without fetching credentials itself. .PP Registry and alias selection: .IP \(bu 2 Use \fB--registry\fR only 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. .IP \(bu 2 \fB--registry-alias\fR applies to \fB--maven\fR and \fB--gradle\fR only, because \fB--npm\fR and \fB--sbt\fR key their entries on \fB--registry\fR itself. For \fB--gradle\fR, 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 \fB${...}\fR\&. .PP 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/. .SH OPTIONS \fB--docker\fP[=false] Configure Docker to authenticate against the registry. Writes to $DOCKER_CONFIG, or ~/.docker when it is unset. .PP \fB--duration\fP=15m0s How long the exchanged token should remain valid. Ignored for --docker. .PP \fB--gradle\fP[=false] Configure Gradle to authenticate against the registry. Writes to ~/.gradle/gradle.properties. .PP \fB--hostname\fP="" GitLab hostname to request the token from. Defaults to the configured GitLab instance. .PP \fB--maven\fP[=false] Configure Maven to authenticate against the registry. Writes to ~/.m2/settings.xml. .PP \fB--npm\fP[=false] Configure npm to authenticate against the registry. Writes to ~/.npmrc. .PP \fB--registry\fP="" Registry to authenticate against. For --docker, a bare hostname; for others, typically a URL. .PP \fB--registry-alias\fP="" Alias/ID to register the registry under (Maven/Gradle only). Defaults to a name derived from --registry. .PP \fB--sbt\fP[=false] Configure sbt to authenticate against the registry. Writes to ~/.sbt/1.0/credentials.sbt. .SH OPTIONS INHERITED FROM PARENT COMMANDS \fB-h\fP, \fB--help\fP[=false] Show help for this command. .SH EXAMPLE .EX # 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 sbt to authenticate against a registry for two hours glab artifact-registry login --sbt --registry https://ar.example.com --duration 2h .EE .SH SEE ALSO \fBglab-artifact-registry(1)\fP