git远程仓库添加sshkey
Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts. Permission denied (publickey)
解决方案
- 1,生成公钥,注意""中的账号必须是gitlab的登录账号,随便输入会失败
$ ssh-keygen -t rsa -C "wupengcheng"
- 随后出现如下命令,路径可以不用修改,直接回车就行
Enter file in which to save the key (/root/.ssh/id_rsa):
接下来输入两次密码,回车表示不设置密码:我就是直接回车的
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
出现如下画面,表示成功
![image-20200923103912587](https://img-blog.csdnimg.cn/img_convert/242852006f78bb46ee175b9b13000426.png)
2,然后打开id_rsa.pub(windows在用户目录下的.ssh文件夹)文件,把以ssh-rsa开头 以刚才输入的账号吴鹏程结尾的key 复制下来。
3,在gitlab上添加刚刚生成的公钥 ,账号-设置-安全设置-ssh公钥
![image-20200923104047400](https://img-blog.csdnimg.cn/img_convert/d584dc8a758229b81181b56b1128ee4f.png)
4,这个时候再次通过sourcetree添加gitlab上的项目就正常
Q.E.D.