最近在学习git,在学习过程中向github添加远程库的时候出现了一些错误。
$ git push -u origin master
Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.
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.
解决办法:
1.首先输入命令 : ssh-keygen -t rsa -C "1194199300@qq.com"
命令作用为重新生成rsa key, ""内是邮箱,这个是我的邮箱,你也可以填你自己的。
2.一直按回车键回到底,就会重新生成rsa key
/c/Users/ymy/.ssh/id_rsa.pub.
3. 复制我在命令行中标记的内容,在我的电脑里找到这个文件复制里边的内容。
4.打开githup登陆账号点击 设置 ——SSH and GPG keys ———添加新的Key
5.把刚刚所复制的内容粘贴进去
6.再次输入命令
git push origin master
7.搞定了