The problem: somthing wrong when my computer excute the command "git clone XXXX"

Error:git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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

Reason:I choose "n" when I first excute git clone command

Solution1:reinstall git

Source:

https://blog.csdn.net/weixin_42128364/article/details/81297741

sudo apt-get purge //常规卸载

sudo apt-get autoremove // 自动清理一些程序

sudo apt-get autoclean

dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P XXX //删除不需要的配置文件

sudo apt-get update //更新本地缓存文件

 

Solution2: about "ssh"

man -k ssh

Solution3:

https://www.jianshu.com/p/3b56f4e6ac77

  git config --global user.name "yourname"   //设置Git的user nameemail

  git config --global user.email "youremail" 

  // after these steps,生成SSH密钥

  // cd ~/.shh 查看是否已经有了ssh密钥

  ssh-keygen -t rsa -C “youremail”  // 生成密钥

DISPLAY

our identification has been saved in /home/tekkub/.ssh/id_rsa.Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.The key fingerprint is:


作者:Smallwolf_JS
链接:https://www.jianshu.com/p/3b56f4e6ac77
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

按3个回车,密码为空

最后得到了两个文件:id_rsaid_rsa.pub

在github上添加ssh密钥,这要添加的是“id_rsa.pub”里面的公钥

Your identification has been saved in /home/tekkub/.ssh/id_rsa.Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.The key fingerprint is:


作者:Smallwolf_JS
链接:https://www.jianshu.com/p/3b56f4e6ac77
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
Your identification has been saved in /home/tekkub/.ssh/id_rsa.Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.The key fingerprint is:


作者:Smallwolf_JS
链接:https://www.jianshu.com/p/3b56f4e6ac77
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
Your identification has been saved in /home/tekkub/.ssh/id_rsa.Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.The key fingerprint is:


作者:Smallwolf_JS
链接:https://www.jianshu.com/p/3b56f4e6ac77
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

 

posted @ 2018-11-10 22:25  Tuicy  阅读(190)  评论(0编辑  收藏  举报