【问题标题】:Permission denied to remote repo. Could not read from repote repository远程回购的权限被拒绝。无法从远程存储库中读取
【发布时间】:2023-03-30 12:19:01
【问题描述】:

这个错误经常出现,但是通常的方法并没有解决这个问题:GIT push: permission denied (public key)

此修复对我没有帮助。我能够做到:

ssh -T git@github.com

...完全没有问题。

git remote -v

... 还返回带有 SSH 模式的正确 URL。

这是我第三次尝试链接到 GitHub 页面,所以我不确定为什么我现在才遇到这个问题。 github页面的主机是否有可能拒绝我的访问?莫非是他们的错?

我可以从这个分支中提取并合并,但是当我尝试推送我的合并冲突以及对代码的一些更新时,我现在收到错误消息(在输入我的 ssh 密钥的密码后):

Enter passphrase for key '~/.ssh/id_rsa':
ERROR: Permission to <path>.git denied to <UserName>.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

也许我的用户名是错误的?我尝试将其设置为我的 github 名称以及我被拒绝的返回名称。

提前感谢您的帮助!

【问题讨论】:

  • 远程 URL 的形式是:git@github.com:&lt;user&gt;/&lt;repo-name&gt;.git?
  • 如果你真的可以git pull,那么你的 URL 和凭据就不会错(我认为)。您确定回购的所有者已授予您推送的权利吗?如果您是所有者,那么您可能需要将 GitHub 配置为允许推送。
  • 不,我怀疑他们没有给我权利!感谢您的帮助!

标签: git


【解决方案1】:

我认为您根本无权写入此存储库。

例如:

$ git clone git@github.com:freeCodeCamp/freeCodeCamp.git
Cloning into 'freeCodeCamp'...
remote: Enumerating objects: 113, done.
remote: Counting objects: 100% (113/113), done.
remote: Compressing objects: 100% (77/77), done.
remote: Total 96160 (delta 46), reused 81 (delta 36), pack-reused 96047
Receiving objects: 100% (96160/96160), 63.21 MiB | 1.58 MiB/s, done.
Resolving deltas: 100% (57205/57205), done.
Checking connectivity... done.

$ cd freeCodeCamp

$ git checkout -b push-test
Switched to a new branch 'push-test'

$ touch push-test

$ git add push-test 

$ git commit -m push-test
[push-test 0916790] push-test
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 push-test

$ git push origin push-test 
ERROR: Permission to freeCodeCamp/freeCodeCamp.git denied to msbit.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

正如@tim-biegeleisen 所说,您必须与存储库所有者(可能是您自己?)交谈并让他们允许您的用户访问。这将是ssh -T git@github.com 的输出中提到的那个。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-02-15
    • 1970-01-01
    • 2014-08-30
    • 1970-01-01
    • 2021-05-01
    • 2016-11-28
    • 2018-08-24
    相关资源
    最近更新 更多