windows下生成github ssh key详解

一、ssh是什么:ssh是Secure Shell(安全外壳协议)的缩写,建立在应用层和传输层基础上的安全协议。为了便于访问github,要生成ssh公钥,这样就不用每一次访问github都要输入用户名和密码。

二、

1.在本地成功安装好Git之后。单击鼠标右键,选择Git Bush here,打开git bush。

2.输入命令:ssh-keygen -t rsa -C "[email protected]"引号中是你在github上的注册邮箱,之后设定你的ssh密码


3.依次输入以下命令

4.在id_rsa的文件夹中打开id_rsa.pub文件,复制粘贴到GitHub上面的SSH keys

5.测试

执行”ssh -T [email protected]” 命令时。如果出现下面两个提示。恭喜你测试失败

输入“ ssh -T -p 443 [email protected]” 测试成功。目测是端口的问题吧。

6.解决方法

在存放公钥私钥(id_rsa和id_rsa.pub)的文件里,新建config文本,内容如下:

Host github.com
User YourEmail@163.com
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

猜你喜欢

转载自blog.csdn.net/zhuyuchao11/article/details/78739338
今日推荐