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 Go1.24. For more details about the GOAUTH environment variable, seehttps://pkg.go.dev/cmd/go#hdr-GOAUTH_environment_variable.When you configure the GOAUTH environment variable for repositories, ArtifactRegistry looks for credentials in the following order:
- Application Default Credentials (ADC)
- Credentials provided by the Google Cloud CLI, including user credentials fromthe command
gcloud authapplication-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, theauthentication 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.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-07 UTC.