Permanently added 'github.com,xx.xx' (RSA) to the list of known hosts。github配置公钥方法!

git push 报错:

Warning: Permanently added ‘github.com,xx.xxx.xxx.xx’ (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

原因:在GitHub中上传代码需要设置公钥,如果设置则可能是当前操作用户与GitHub中存储公钥不匹配。

解决方法

[[email protected] /]$ cd      //进入xxx用户的家目录
[[email protected] ~]$ cd  ~/.ssh/      //进入公私钥存储地方
[[email protected] .ssh]$ ssh-******    //生成公私钥!如果已存在公私钥可以不用生成。

Permanently added 'github.com,xx.xx' (RSA) to the list of known hosts。github配置公钥方法!

[[email protected] .ssh]$ cat id_rsa.pub    //查看公钥内容 

复制公钥 从ssh-rea开始到[email protected]


注意:不需要复制[email protected]


将复制的公钥存储到github上
Permanently added 'github.com,xx.xx' (RSA) to the list of known hosts。github配置公钥方法!
重新push代码即可!

感谢支持!