Git当中如何创建SSH Key

创建SSH Key
马克- to-win:马克 java社区:防盗版实名手机尾号: 73203。



马克-to-win:因为本地git仓库和远程的github仓库之间是通过ssh加密传输的,所以需要创建一个SSH Key。

注意下面的实验中,Documents and Settings在win7下面是不能访问的,由于安全问题, 参考我目录下的文章,看怎么解决。

Windows下打开Git Bash,输入以下命令

ssh-keygen -t rsa -C iscp9158_work@163.com

console里面的输出结果是:




$ ssh-keygen -t rsa -C iscp9158_work@163.com
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Documents and Settings/dell/.ssh/id_rsa):
Created directory '/c/Documents and Settings/dell/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Documents and Settings/dell/.ssh/id_rsa.
Your public key has been saved in /c/Documents and Settings/dell/.ssh/id_rsa.pub.

dell@dell MINGW32 ~
$

找到.ssh文件夹,打开就可以看到两个文件id_rsa和id_rsa.pub,

打开id_rsa.pub,将其中的内容复制下来(这就相当于一把钥匙,将来传输时用),下面是我的: