我正在做 GoogleCloudReady Facilitator Program workshop labs,我在做实验时遇到了问题。
当我尝试运行 gcloud auth list
命令时,我面临着
To login, run:
$ gcloud auth login `ACCOUNT`
我的预期输出应该是
[core]
project = <project_ID>
以及根据文档。
请帮帮我,我的时间已经过去了。
最佳答案
正如之前一些评论提到的,您需要先进行身份验证。根据您遵循的指南或实验室,可能会为您设置配置或初始化。
例如:在这个qwiklab无需运行 gcloud auth login
因为 shell 已在配置文件中为您初始化,因此您可以使用 gcloud auth list
无需运行第一个命令。
在实验室之外,在控制台中或使用 CLI,您需要制作一些 Configurations :
A configuration is a set of gcloud CLI properties. A configuration works like a profile.
When you start using the gcloud CLI, you'll work with a single configuration named default and you can set properties by running
gcloud init
orgcloud config set
. This single default configuration is suitable for most use cases.
这是设置gcloud CLI时的第一步,Initializing the gcloud CLI .
gcloud init
performs the following setup steps:
Authorizes the gcloud CLI to use your user account credentials to access Google Cloud, or lets you select an account if you have previously authorized access
Sets up a gcloud CLI configuration and sets a base set of properties, including the active account from the step above, the current project, and if applicable, the default Compute Engine region and zone
You can run the following as alternatives to gcloud init:
gcloud auth login
gcloud auth activate-service-account
因此,根据具体情况,您可能只需要指出您正在使用哪个用户帐户的 shell(以防它没有像前面提到的 qwiklab 中的 image 那样指定,它会为您完成所有初始化)使用 gcloud auth login
,或者您可能需要使用 gcloud init
设置一个全新的配置文件.
在这种情况下,您是 listing accounts无需先进行身份验证,这就是它打印该消息的原因。
执行登录/初始化命令后,您可以get the active authenticated gcloud account或列出您之前尝试过的帐户,以确认您现在使用的是正确的帐户。
关于google-cloud-platform - GCP 云外壳错误 : No credentialed accounts,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72232568/