- NAME
-
- gcloud artifacts go auth - print authentication commands for the GOAUTH environment variable
- SYNOPSIS
-
-
gcloud artifacts go auth
[URL
…]--location
=LOCATION
[--json-key
=JSON_KEY
] [GCLOUD_WIDE_FLAG …
]
-
- DESCRIPTION
-
This command implements the GOAUTH credential provider command introduced in Go
1.24. For more details about the GOAUTH environment variable, see https://pkg.go.dev/cmd/go#hdr-GOAUTH_environment_variable.
When you configure the GOAUTH environment variable for repositories, Artifact
Registry looks for credentials in the following order:
- Application Default Credentials (ADC)
-
Credentials provided by the Google Cloud CLI, including user credentials from
the command
gcloud auth application-default login
.
- EXAMPLES
-
To configure the GOAUTH environment variable for repositories in
us-central1
and use your credentials:export GOAUTH="gcloud artifacts go auth --location=us-central1"
To configure the GOAUTH environment variable for repositories in
us-central1
and use the credentials from a service account:export GOAUTH="gcloud artifacts go auth --location=us-central1 --json-key=path/to/key.json"
- POSITIONAL ARGUMENTS
-
- [
URL
…] - A URL generated by Go to set up authentication.
- [
- REQUIRED FLAGS
-
--location
=LOCATION
- The location of the repository to print commands for.
- OPTIONAL FLAGS
-
--json-key
=JSON_KEY
- The path to the JSON key file to use for authentication. If not specified, the authentication commands printed will use the token from the logged in user.
- GCLOUD WIDE FLAGS
-
These flags are available to all commands:
--access-token-file
,--account
,--billing-project
,--configuration
,--flags-file
,--flatten
,--format
,--help
,--impersonate-service-account
,--log-http
,--project
,--quiet
,--trace-token
,--user-output-enabled
,--verbosity
.Run
$ gcloud help
for details.
gcloud artifacts go auth
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-04-15 UTC.