Git SSH Key在windows下生成过程
切换到C:\Users\\.ssh
执行命令:ssh-keygen -t rsa -C “邮箱地址”
Generating public/private rsa key pair.
Enter file in which to save the key (//.ssh/id_rsa):
第一次生成由于没有id_rsa文件和id_rsa.pub文件,所以需要生成这两个文件,然后手动输入:./id_rsa
Enter file in which to save the key (//.ssh/id_rsa): ./id_rsa,虽然要求输入//.ssh/id_rsa,但这种方式不是在当前目录下
接下来两部是要求输入密码,不输入直接回车就完成了。
PS C:\Users\admin\.ssh> ssh-keygen -t rsa -C "myemail@163.com"
Generating public/private rsa key pair.
Enter file in which to save the key (//.ssh/id_rsa): ./id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in ./id_rsa.
Your public key has been saved in ./id_rsa.pub.
The key fingerprint is:
9c:cc:db:3e:72:82:73:2e:41:0e:17:f4:3c:ea:70:4a myemail@163.com
The key"s randomart image is:
+--[ RSA 2048]----+
| .o |
| + |
| . o + |
| O o . |
| E S |
| . = = |
| . * = + |
| = = . |
| . |
+-----------------+
最后将.ssh目录下id_rsa.pub文件中的内容复制并添加到github或其他支持资源库中就可以使用ssh的协议clone资源了,没有添加进去是不能克隆的。
生成sshkey的命令:ssh-keygen是要在安装git后才能使用,在git的bin目录下有这个文件的,如果再cmd命令行下不能使用可以试试git-bash命令行模式下使用。