gcloud artifacts go auth
Stay organized with collections
Save and categorize content based on your preferences.
- 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-central1and use your credentials:exportGOAUTH="gcloud artifacts go auth --location=us-central1"To configure the GOAUTH environment variable for repositories in
us-central1and use the credentials from a service account:exportGOAUTH="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 helpfor details.