原因分析
出现这个问题一般是两个原因造成:
- 公钥不匹配
- 服务端或客户端公钥未生成
知道问题所在也就知道了怎么去解决了
解决方法
客户端生成ssh-key
ssh-keygen -t rsa -C "你注册的邮箱"
Generating public/private rsa key pair.
Enter file in which to save the key (/path/.ssh/id_rsa): 文件生成别名
Enter passphrase (empty for no passphrase):密码(直接回车跳过)
Enter same passphrase again:密码(直接回车跳过)
Your identification has been saved in github.
Your public key has been saved in github.pub.
The key fingerprint is:
SHA256:E9KpYQTd1Dh6ZOaLk6gL9bTjORzfaWE/P5oGulfyYfo 你注册的邮箱
The key's randomart image is:
+---[RSA 3072]----+
| .o.o.o |
| ...B.. |
| +*+. |
| ..+o. |
| . ...+S. |
| . oo.+ *.+ |
|. o+o = @ . |
| ...ooo * =.. |
| ..o..+ oE+.. |
+----[SHA256]-----+
服务端配置客户端的ssh-key
本地添加私钥
ssh-add 私钥文件名称
本地验证Key
ssh -T git@github.com # github
ssh -T git@gitee.com # 码云
出现Hi CoderSamYhc! You've successfully authenticated, but GitHub does not provide shell access.
- 本文链接:http://codersam.cn/2020/10/16/%E8%A7%A3%E5%86%B3Permission_denied%E9%97%AE%E9%A2%98/
- 版权声明:本博客所有文章除特别声明外,均默认采用 许可协议。