0%

解决错误 GitHub Permission denied fatal Could not read from remote repository


机器上使用了多个 Git 库,比如 GitHub/公司 Git 库等,Git 工具主要使用 Terminal 和 GitKraken,偶尔会出现奇怪的问题。比如前两天在部署 Hexo Blog 时,遇到以下报错:

1
2
3
4
5
Permission denied (publickey).
fatal: Could not read from remote repository.

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

通常的解决方案是重新生成 GitHub 的 SSH Key。

但是我本地的配置是没问题的,可以在 Terminal 和GitKraken正常提交代码。

猜想可能是哪个环节不通,于是使用:

1
ssh -T git@github.com

看到:

1
Hi {username}! You've successfully authenticated, but GitHub does not provide shell access.

再重新部署提交,搞定!

参考:

https://docs.github.com/en/authentication/troubleshooting-ssh/error-permission-denied-publickey

Amon wechat
扫一扫关注我,有惊喜不迷路
(转载本站文章请注明作者和出处: 猛猛如玉
网址: https://amonxu.com 微信公众号: itcraft
可以请我喝瓶水吗:)