拨开荷叶行,寻梦已然成。仙女莲花里,翩翩白鹭情。
IMG-LOGO
主页 文章列表 Google源代码库的权限被拒绝

Google源代码库的权限被拒绝

白鹭 - 2022-01-26 2004 0 0

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

我已经检查了我能想到的所有内容:

  • 更新了 gcloud: gcloud components update
  • 重新初始化: gcloud init
  • 重新安装 gcloud 工具
  • 更新了 git
  • 将 repo 克隆到新目录(无权限)
  • 我仍然可以访问控制台: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.

uj5u.com热心网友回复:

您可以做的第一件事是检查存盘库详细信息并检查access level需要设定的访问权限write

然后转到工具->选项和身份验证并洗掉所有密码,git saved password或者您可以使用以下命令:

git config --system -l

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

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

有关洗掉凭据??的更多信息,请参阅此链接

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

uj5u.com热心网友回复:

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

我没有在那里提到相同的档案,但我洗掉~/.netrc了,现在 git 正在作业。

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

标签:

0 评论

发表评论

您的电子邮件地址不会被公开。 必填的字段已做标记 *