简体   繁体   English

Google 源回购拒绝权限

[英]Permission denied with Google source repo

I've been using Google source repos for many years, and now I'm getting permission denied when I try to push or pull.多年来我一直在使用 Google source repos,现在当我尝试推送或拉取时,我的权限被拒绝了。

I've checked everything I can think of:我检查了我能想到的一切:

  • Updated gcloud: gcloud components update更新了 gcloud: gcloud components update
  • Reinitialized: gcloud init重新初始化: gcloud init
  • Reinstalled gcloud tools重新安装 gcloud 工具
  • Updated git更新 git
  • Cloned repo to new directory (no permission)克隆回购到新目录(无权限)
  • I still have access on the console: https://source.cloud.google.com/project/default我仍然可以访问控制台: https://source.cloud.google.com/project/default
  • Closed and reopened terminal关闭和重新打开终端
  • I'm the owner of the organization and the project but I also added all source repository permissions我是组织和项目的所有者,但我还添加了所有源存储库权限

The above process sets my account and project so those are all set.上面的过程设置了我的帐户和项目,所以这些都设置好了。

I just tried on a different computer (Windows 10), and I don't get permission denied.我刚刚在另一台计算机 (Windows 10) 上试过,但没有被拒绝许可。 The issue has something to do with my Mac setup...这个问题与我的 Mac 设置有关......

Below are some examples:下面是一些例子:

$ 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.

The first you can do is check the repository details and check the access level and the acces need to be set to write首先您可以检查存储库详细信息并检查access level以及需要将访问权限设置为write

Then go to tools -> Options and Authentication and delete all the passwords under git saved password or you could use the following commands:然后 go 到 tools -> Options and Authentication 并删除git saved password ,或者您可以使用以下命令:

git config --system -l

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

And then use git config --system --unset credential.helper to remove the saved credentials (make sure you run this as an admin)然后使用git config --system --unset credential.helper删除保存的凭据(确保以管理员身份运行)

More on the subject on removing the credentials refer to this link有关删除凭据的更多信息,请参阅此链接

If removing the credentials doesn't work, here is another link to help you with the 403 error using the SSH or modifying the HTTPS URL如果删除凭据不起作用,这里有另一个链接可以帮助您使用 SSH 或修改 HTTPS ZE6B391A8D2C4D45902A23A8B6585703D 来帮助您解决403 错误

I found this answer to another to another similar question.我找到了另一个类似问题的答案

I didn't have the same file mentioned there, but I deleted ~/.netrc and now git is working.我没有在那里提到相同的文件,但我删除了~/.netrc ,现在 git 正在工作。

The .netrc file has been there since 2017. No idea why that made a difference now... .netrc文件自 2017 年以来一直存在。不知道为什么现在会有所不同......

I also experienced the same.我也有同样的经历。 The repo existed and I had the correct permissions, but I still got the same error.回购存在并且我拥有正确的权限,但我仍然遇到同样的错误。

You have to add your ssh key to ssh agent您必须将 ssh 密钥添加到 ssh 代理

ssh-agent -s
ssh-add <pathtokey>

eg.例如。

ssh-add ~/.ssh/id_rsa

This worked for me这对我有用

You probably are using a standard RSA key, which is not supported.您可能正在使用不受支持的标准 RSA 密钥。 You need to use another algorithm.您需要使用另一种算法。 Try creating a new one using the following command:尝试使用以下命令创建一个新的:

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

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

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

相关问题 谷歌云源存储库:权限被拒绝(公钥) - Google Cloud Source Repositories: Permission denied (publickey) Google Cloud Source Repository:远程:PERMISSION_DENIED:调用者没有远程权限 - Google Cloud Source Repository: remote: PERMISSION_DENIED: The caller does not have permission remote 谷歌云 scp 权限被拒绝 - Google cloud scp permission denied Google Cloud Storage 权限被拒绝 - Google Cloud Storage permission denied 谷歌 Stackdriver API 权限被拒绝 - Google Stackdriver API permission denied 使用谷歌云 SDK Windows 10 上的身份验证方法获取 Git 推送到谷歌云源存储库的权限被拒绝(公钥) - Get Permission denied (publickey) for Git push to Google Cloud Source Repository with Google Cloud SDK authentication method on Windows 10 IAM 权限被拒绝 - Google Cloud 创建指标 - IAM Permission Denied - Google Cloud Create metric Firebase 禁止谷歌身份验证(权限被拒绝) - Firebase Google authentication forbidden (permission denied) 谷歌云翻译权限被拒绝 - 但有作用 - Google Cloud Translation Permission Denied - But has role 谷歌云中的权限被拒绝(公钥)错误是否有任何解决方法? - Is there any workaround for the permission denied (publickey) error in google cloud?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM