← 返回命令列表

Linux command

gcloud-auth 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Login interactively

gcloud auth login

Activate service account

gcloud auth activate-service-account --key-file=[key.json]

List accounts

gcloud auth list

Print access token

gcloud auth print-access-token

Revoke credentials

gcloud auth revoke [account]

说明

gcloud auth manages authentication and authorization for Google Cloud Platform access. All gcloud operations require valid credentials, which this command group provides and maintains. For interactive use, the login command initiates a browser-based OAuth flow where you authenticate with your Google account. For automation and server environments, service accounts can be activated using JSON key files, providing non-interactive authentication suitable for CI/CD pipelines. The command supports multiple concurrent authenticated accounts, allowing you to switch between different Google accounts or between user accounts and service accounts. Only one account is active at a time, but switching is quick and preserves all credentials. Access tokens can be printed for use with external tools that need to authenticate to Google Cloud APIs.

参数

login
Authenticate with user account.
activate-service-account
Authenticate with service account.
list
List authenticated accounts.
print-access-token
Output current access token.
revoke _ACCOUNT_
Revoke credentials.
--key-file _FILE_
Service account key file.
application-default
Manage Application Default Credentials for local development and client libraries.
configure-docker
Register gcloud as a Docker credential helper for pushing/pulling to Artifact Registry and Container Registry.
--help
Display help information.

FAQ

What is the gcloud-auth command used for?

gcloud auth manages authentication and authorization for Google Cloud Platform access. All gcloud operations require valid credentials, which this command group provides and maintains. For interactive use, the login command initiates a browser-based OAuth flow where you authenticate with your Google account. For automation and server environments, service accounts can be activated using JSON key files, providing non-interactive authentication suitable for CI/CD pipelines. The command supports multiple concurrent authenticated accounts, allowing you to switch between different Google accounts or between user accounts and service accounts. Only one account is active at a time, but switching is quick and preserves all credentials. Access tokens can be printed for use with external tools that need to authenticate to Google Cloud APIs.

How do I run a basic gcloud-auth example?

Run `gcloud auth login` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does login do in gcloud-auth?

Authenticate with user account.