What causes Google gcloud error message "ERROR: (gcloud) Invalid choice: 'get'. Did you mean 'meta'?" mean?

What causes Google gcloud error message "ERROR: (gcloud) Invalid choice: 'get'. Did you mean 'meta'?" mean?

当我尝试 git push 到 Google 云存储库时,我收到以上消息。 然后它要求我输入我的凭据。之后我收到以下错误:

Valid choices are [auth, components, compute, config, container, deployment-manager, dns, docker, feedback, help, info, init, meta, preview, projects, source, sql, topic, version]. fatal: Authentication failed for 'https://source.developers.google.com/p/projectname/'

有什么遗漏吗?

试试这个:

转到:

https://console.developers.google.com/project/your-project-id > 
Source Code > 
Browse > 
Find this line : 

Alternatively, instead of using the Google Cloud SDK to manage your authentication, you can manually generate your Git credentials by following this link...

Click "following this link" and you can see your git password.

  • 使用上面的 gmail 和 git 密码克隆存储库。
  • 或在您的主文件夹中创建 .netrc 文件并添加:

machine source.developers.google.com
login your-email@gmail.com
password ...

它不会再次请求您的密码。

正如 git config --list 在您的设置中显示的那样,git 凭据助手指向

credential.helper=/opt/google-cloud-sdk/bin/gcloud

这似乎不正确。助手不应包含绝对路径。您可以通过 运行

将其重置为正确的值
$ git config credential.helper gcloud.sh

要使上述工作正常,gcloud 必须在您的 PATH 环境变量中,否则 git 将无法找到 git-credential-gcloud.sh。确保

$ which git-credential-gcloud.sh

returns所在路径。如果没有,你可以 运行 set path

$ source /opt/google-cloud-sdk/path.bash.inc