首页 > 解决方案 > 无法从 Google Cloud Source Repository 克隆

问题描述

我在一个组织内创建了一个项目(ID:imagetest1-259203)。我使用成功创建了一个存储库

gcloud source repos create repo1

但是当我尝试将其克隆到我的电脑时

gcloud source repos clone repo1

我得到以下问题。(注意:我已经启用了“Cloud Source Repositories API”

Cloning into 'D:\AppEngineTests\repo1'...
remote: PERMISSION_DENIED: The caller does not have permission
remote: [type.googleapis.com/google.rpc.RequestInfo]
remote: request_id: "2e79f3c507f14b3190d7a5941bed3e5f"
fatal: unable to access 'https://source.developers.google.com/p/imagetest1-259203/r/repo1/': The requested URL returned error: 403
ERROR: (gcloud.source.repos.clone) Command '[u'git', u'clone', u'https://source.developers.google.com/p/imagetest1-259203/r/repo1', u'D:\\AppEngineTests\\repo1', u'--config', u'credential.helper=', u'--config', u'credential.helper=!gcloud.cmd auth git-helper --account=prabodar@xellmart.com --ignore-unknown $@']' returned non-zero exit status 128

但是当我使用相同的命令集克隆到 Cloud Shell 时,它成功了。

标签: google-cloud-platformgoogle-cloud-source-repos

解决方案


我有这个问题好几个月了,我使用了两个不同的帐户,个人帐户和工作帐户。它可以在一台 PC 上运行,但不能在另一台 PC 上运行。

修复:重命名或删除此文件:%USERPROFILE%_netrc

我试过了:

  • gcloud auth revoke + 然后 gcloud auth init
  • 重命名 .gitconfig
  • 重命名 .gitcookies
  • 已删除 %USERPROFILE%\AppData\Roaming\gcloud
  • 使用“git”从 Windows 凭据管理器中删除凭据最终运行 procmon 以跟踪它正在读取的文件。
  • 将 _netrc 重命名为 _netrc.backup 命令然后工作。取消重命名并再次测试,再次返回错误消息。

推荐阅读