Permission denied (publickey)
2020/12/01 1:28:57 pm
原因分析
解决提交github出现
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
- 客户端与服务端未生成 ssh key
- 客户端与服务端的ssh key不匹配
生成SSH Key
1
| ssh-keygen -t rsa -C "你的github注册邮箱"
|
注:途中会让你输入密码啥的,不需要管,一路回车即可,会生成你的ssh key。(如果重新生成的话会覆盖之前的ssh key。)
最后两句会出现
- No more authentication methods to
- Permission denied (publickey).
在终端再执行以下命令
1 2 3 4 5 6
| ssh-agent -s 接着在执行 ssh-add ~/.shh/id_rsa ~/.ssh open ./ 复制id_rsa.pub 到github下创建SSH keys
|
验证Key
1 2
| ssh -T git@github.com Hi “github用户名”!You've successfully authenticated, but GitHub does not provide shell access.问题接解决了!
|
详见: https://blog.csdn.net/ywl470812087/article/details/104459288