繁体   English   中英

Google 源回购拒绝权限

[英]Permission denied with Google source repo

多年来我一直在使用 Google source repos,现在当我尝试推送或拉取时,我的权限被拒绝了。

我检查了我能想到的一切:

  • 更新了 gcloud: gcloud components update
  • 重新初始化: gcloud init
  • 重新安装 gcloud 工具
  • 更新 git
  • 克隆回购到新目录(无权限)
  • 我仍然可以访问控制台: https://source.cloud.google.com/project/default
  • 关闭和重新打开终端
  • 我是组织和项目的所有者,但我还添加了所有源存储库权限

上面的过程设置了我的帐户和项目,所以这些都设置好了。

我刚刚在另一台计算机 (Windows 10) 上试过,但没有被拒绝许可。 这个问题与我的 Mac 设置有关......

下面是一些例子:

$ git pull
remote: PERMISSION_DENIED: The caller does not have permission
remote: [type.googleapis.com/google.rpc.RequestInfo]
remote: request_id: "xxx"
fatal: unable to access 'https://source.developers.google.com/p/project/r/default/': The requested URL returned error: 403

$ gcloud source repos clone default --project=project
Cloning into '/Users/user/TMP/default'...
remote: PERMISSION_DENIED: The caller does not have permission
remote: [type.googleapis.com/google.rpc.RequestInfo]
remote: request_id: "xxx"
fatal: unable to access 'https://source.developers.google.com/p/project/r/default/': The requested URL returned error: 403
ERROR: (gcloud.source.repos.clone) Command '['git', 'clone', 'https://source.developers.google.com/p/project/r/default', '/Users/user/TMP/default', '--config', 'credential.https://source.developers.google.com/.helper=', '--config', 'credential.https://source.developers.google.com/.helper=!gcloud auth git-helper --account=me@example.com --ignore-unknown $@']' returned non-zero exit status 128.

$ git clone ssh://me@example.com@source.developers.google.com:2022/p/project/r/default
Cloning into 'default'...
me@example.com@source.developers.google.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

首先您可以检查存储库详细信息并检查access level以及需要将访问权限设置为write

然后 go 到 tools -> Options and Authentication 并删除git saved password ,或者您可以使用以下命令:

git config --system -l

你会得到, credential.helper=!github --credentials

然后使用git config --system --unset credential.helper删除保存的凭据(确保以管理员身份运行)

有关删除凭据的更多信息,请参阅此链接

如果删除凭据不起作用,这里有另一个链接可以帮助您使用 SSH 或修改 HTTPS ZE6B391A8D2C4D45902A23A8B6585703D 来帮助您解决403 错误

我找到了另一个类似问题的答案

我没有在那里提到相同的文件,但我删除了~/.netrc ,现在 git 正在工作。

.netrc文件自 2017 年以来一直存在。不知道为什么现在会有所不同......

我也有同样的经历。 回购存在并且我拥有正确的权限,但我仍然遇到同样的错误。

您必须将 ssh 密钥添加到 ssh 代理

ssh-agent -s
ssh-add <pathtokey>

例如。

ssh-add ~/.ssh/id_rsa

这对我有用

您可能正在使用不受支持的标准 RSA 密钥。 您需要使用另一种算法。 尝试使用以下命令创建一个新的:

ssh-keygen -t ecdsa -C "[USER_EMAIL]"

来源: https://cloud.google.com/source-repositories/docs/authentication#ssh

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM