github长期未登陆,Warning: Permanently added the RSA host key for IP address '172.16.xxx.xxx' to the list of known hosts.

在输入如下命令

 git add test.txt

 git commit -m"modify record..."

 git push -u origin master

之后,出现没有权限的提示

Warning: Permanently added the RSA host key for IP address '172.16.xxx.xxx' to the list of known hosts. 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-keygen -t  rsa  -C"ring04w"

可以知道公钥目录/Users/ring04w/.ssh/id_rsa.pub,一路enter下去

然后,通过cat 命令将key显示出来,再将其添加到github上。

个人账号---Settings--- SSH  and GPG keys--New SSH key---复制进去,add,确定就可以了。

删除命令 git rm -r test.txt

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

友情链接更多精彩内容