gcloud init 失败,原因是用户名/密码无效。

3

我正在尝试访问现有的Google开发者控制台(GDC)项目中嵌入的git存储库。 GDC在“源代码-发布”下显示git存储库。 我按照官方gcloud安装说明进行操作:

gcloud auth login /* pulls up browser and does authentication just fine */
gcloud config set project <project>
gcloud init <project>

后者总是会导致以下结果(将实际项目名称替换为“鱼骨”):
$gcloud init fishbone
Initialized gcloud directory in [/Users/dummy/Workspace/fishbone/.gcloud].
Cloning [https://source.developers.google.com/p/fishbone/r/default] into [default].
Initialized empty Git repository in /Users/dummy/Workspace/fishbone/default/.git/
fatal: remote error: Invalid username/password.
You may need to use your OAuth token password; Note that generated google.com passwords are not compatible with private repositories
ERROR: Unable to initialize project [fishbone], cleaning up [/Users/dummy/Workspace/fishbone].
ERROR: (gcloud.init) Could not fetch repository.

只有在SDK的第一次安装中(现在已经尝试了多次),我记得gcloud init会要求输入用户名。之后再也没有出现过这个问题。我的电脑是Mac OS X 10.9.3。

$git --version
$git version 1.8.5.2 (Apple Git-48)

我知道这个相关的gcloud初始化问题,但那不是这个问题。非常感谢您的帮助。

3个回答

1

前往https://console.developers.google.com/project/your-project-id > 源代码 > 浏览 > 找到这一行:"Alternatively, instead of using the Google Cloud SDK to manage your authentication, you can manually generate your Git credentials by following this link." > 点击“following this link”,你就可以看到你的git密码。正如你在错误信息中所看到的,Google密码与私人存储库不兼容。现在你可以:

  • 使用上面提供的gmail和git密码来克隆资源库。
  • 或者在你的主目录下创建一个.netrc文件,并添加以下内容:"machine source.developers.google.com login your-email@gmail.com password 1/abxxxxxxxxxxxxxxxxxxxxxxx",这样它就不会再次要求你输入密码了。

0

只需前往您的Google开发者控制台,然后单击/查找以下内容:

“或者,您可以通过按照此链接生成Git凭据来手动管理身份验证,而不是使用Google Cloud SDK。”

然后单击“按照此链接”,然后按照该页面上的说明操作即可。

就这样。


0
他们将手动创建的Git凭据选项移动了位置。现在,这些选项位于GCP ->(工具)开发 ->源代码下,并且在克隆新的或现有的存储库时,它们会提供使用gcloud或创建自己的凭据选项。
此外,在下面的截图中 {{link1:Get Starter}}

Google Cloud SDK (Recommended)

Manually Generate, Follow Dropdown


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接