【git基础-err】Permission denied (publickey). fatal: Could not read from remote repository.

problem

Permission denied (publickey).
fatal: Could not read from remote repository.

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

分析

这种问题一般都是密钥设置不正确造成的,首先检查有没有在Git的网站上添加你本机的SSH key。
注意换了电脑是要重新添加的,每台都不一样。在用户主目录下,看看有没有.ssh目录,
如果有,再看看这个目录下有没有id_rsa和id_rsa.pub这两个文件,如果已经有了,可直接跳到下一步。
如果没有,打开Shell(Windows下打开Git Bash),创建SSH Key.

创建SSH Key:

复制代码
Add SSH Public Key
    How to Generate an SSH Key
 
1. From the Terminal or Git Bash, run ssh-keygen
2. Confirm the default path .ssh/id_rsa
3. Enter a passphrase (recommended) or leave it blank.
Remember this passphrase, as you will need it to unlock the
key whenever you use it.
4. Open ~/.ssh/id_rsa.pub and copy & paste the contents into
the box below, then click on "Add".
Note that id_rsa.pub is your public key and can be shared,
while id_rsa is your private key and should be kept secret.
复制代码

验证是否添加成功

$ ssh usrname@usremail

参考

1. git@github.com: Permission denied (publickey). fatal: Could not read from remote repository的问题解决

2. fatal: Could not read from remote repository.的解决办法

 

posted on   鹅要长大  阅读(510)  评论(0编辑  收藏  举报

编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示