【git】解决Permission denied (publickey) 同忘记 enter passphrase for key '~/.ssh/id_rsa'

原因:

ssh密钥失效

解决方法:

1)检查本地ssh密钥文件是否存在,命令如下

    ls ~/.ssh

如果存在,命令行会输出:id_rsa id_rsa.pub known_hosts
如果存在,执行2),否则3)

2)删除ssh文件夹

3)创建新的ssh密钥,命令如下:

ssh-keygen -t rsa -b 4096 -C "这里是你的@邮箱账号"

(这里所遇到的3次提示,直接回车即可)

4)复制3)中生成的id_rsa.pub 粘贴到 coding网站上的 个人帐户>ssh公钥>新增公钥(Github同样,粘贴到ssh公钥对应位置)

5)命令行执行 git push 命令会弹出提示:
The authenticity of host 'e.coding.net xxxxx' can't be established.
RSA key fingerprint is xxxxxxxx.
Are you sure you want to continue connecting (yes/no)?
输入yes回车。

你可能感兴趣的:(【git】解决Permission denied (publickey) 同忘记 enter passphrase for key '~/.ssh/id_rsa')