glab artifact-registry login adds Gradle, npm, sbt, and Maven options
Introduced 2026-08-25 · score 0.96
HOW TO USE IT
When authenticating a project to GitLab Artifact Registry, run `glab artifact-registry login` with the registry URL and the option for its package manager: `--gradle`, `--npm`, `--sbt`, or `--maven`. [GitLab CLI docs](https://docs.gitlab.com/cli/artifact-registry/login/)
glab artifact-registry login --gradle --registry <repository_url>glab artifact-registry login --npm --registry <repository_url>glab artifact-registry login --sbt --registry <repository_url>WHY THIS HELPS
Authenticate glab to the artifact registry for a project using Gradle, npm, sbt, or Maven.
REQUIREMENTS AND LIMITATIONS
- Version: v1.115.0
- --gradle (required): Select Gradle; writes credentials to `~/.gradle/gradle.properties`.
- --npm (required): Select npm; writes an auth-token entry to `~/.npmrc`.
- --sbt (required): Select sbt; writes a credentials line to `~/.sbt/1.0/credentials.sbt`.
- --maven (required): Select Maven; writes a server block to `~/.m2/settings.xml`.
- --registry <repository_url> (required): Registry repository URL to authenticate against; typically a URL for non-Docker clients.
- --registry-alias <alias>: Maven/Gradle only: alias or ID for the registry; defaults to a name derived from the registry. Maven's repository ID must match the alias. For Gradle, use a valid build-script identifier.
- --duration <duration>: Requested token lifetime; default 15 minutes, maximum 12 hours. Re-run login before it expires.
- --hostname <hostname>: GitLab hostname to request the token from; defaults to the configured GitLab instance.
- Prerequisite: Install glab version 1.115.0 or later.
- Prerequisite: Authenticate glab: it uses `GITLAB_TOKEN` when set, otherwise credentials stored by `glab auth login`.
FIRST-PARTY EVIDENCE
- https://gitlab.com/gitlab-org/cli/-/releases/v1.115.0
- https://docs.gitlab.com/artifact-registry/formats/maven/
- https://docs.gitlab.com/artifact-registry/formats/npm/
- https://docs.gitlab.com/cli/artifact-registry/login/
- https://docs.gitlab.com/artifact-registry/authenticate/
Check the installed version and the source before using it. Entry JSON