3

当我尝试git push到Google云存储库时,我收到上面的消息。 然后它会要求我输入我的凭证。之后,我收到以下错误:什么原因导致Google gcloud错误消息“错误:(gcloud)无效的选择:'get'。您的意思是'meta'吗?意思?

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/ '

有什么遗漏吗?

+0

git config --list'显示什么与众不同吗? – Valentin

+0

不是很熟悉git的,但这是'混帐配置--list'输出: core.repositoryformatversion = 0 core.filemode =真 core.bare =假 core.logallrefupdates =真 credential.helper =/opt/google-cloud-sdk/bin/gcloud remote.google.url = https://source.developers.google.com/p/projectid/ remote.google.fetch = + refs/heads/*: refs/remotes/google/* remote.bitbucket.url = https:// username:[email protected]/username/reponame.git remote.bitbucket.fetch = + refs/heads/*:refs/remotes/bitbucket/* – kassold

回答

5

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 

返回它所在的路径。如果它不行,你可以运行设置路径

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

你的意思是'gcloud'必须在我的路径中? – kassold

+0

是的,编辑说gcloud必须在PATH环境中。 – cherba

+0

我很高兴地报告说,这工作。我不知道它有所作为。我不太喜欢将工具添加到我的PATH中。 – kassold

1

试试这个:

转到:

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 [email protected]
password ...

不会再要求您输入密码。

+1

对不起,我无法看到您引用的文字。当我去https://console.developers.google.com/code/develop/browse?project=projectid时,我只能看到简短的描述(例如使用私有的Git托管,访问简单的工具来理解你的代码等)。但我没有看到你引用的文字。 在左侧面板中,我看到“源代码”,“存储库设置”和“工具和插件”。 – kassold

+1

@ cherba的回答解决了我的问题。我虽然赞成这一个。 – kassold