簡體   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