1. 安装git,比如TortoiseGit,
从程序目录打开 "Git Bash" (或是打开c\user\win10)
2. 键入命令:ssh-keygen -t rsa -C "email@email.com" 或输入(
ssh-keygen)
"email@email.com"是github账号
C:\Users\win10>ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/win10/.ssh/id_rsa):
Created directory '/c/Users/win10/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/win10/.ssh/id_rsa.
Your public key has been saved in /c/Users/win10/.ssh/id_rsa.pub.
The key fingerprint is:
e6:21:ab:cb:16:2e:c3:42:db:18:06:ff:00:f3:72:0a win10@WIN-TA017Q0H1IP
The key's randomart image is:
+--[ RSA 2048]----+
|o..o+ |
| o.o.+ |
|E.o=o . |
|. +oo |
| . .. . S |
| o = . |
| + . . |
| .o. |
| .+. |
+-----------------+
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/win10/.ssh/id_rsa):
Created directory '/c/Users/win10/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/win10/.ssh/id_rsa.
Your public key has been saved in /c/Users/win10/.ssh/id_rsa.pub.
The key fingerprint is:
e6:21:ab:cb:16:2e:c3:42:db:18:06:ff:00:f3:72:0a win10@WIN-TA017Q0H1IP
The key's randomart image is:
+--[ RSA 2048]----+
|o..o+ |
| o.o.+ |
|E.o=o . |
|. +oo |
| . .. . S |
| o = . |
| + . . |
| .o. |
| .+. |
+-----------------+
3. 提醒你输入key的名称,输入如id_rsa(
直接按回车键)
4. 在C:\Users\win10\.ssh\下产生两个文件:id_rsa和id_rsa.pub
5. 如果在win10下生成的文件,请把4中生成的密钥文件复制到C:\Users\win10\.ssh\ 目录下。
6. 用记事本打开id_rsa.pub文件,复制内容,在github.com的网站上到ssh密钥管理页面,添加新公钥,随便取个名字,内容粘贴刚才复制的内容。
7. ^_^ OK了
需要注意步骤2中产生的密钥文件在当前用户的根目录,必须把这两个文件放到当前用户目录的“.ssh”目录下才能生效。
在windows中只能在命令行下输入创建"."开头的文件夹。命令为 mkdir .ssh
转载:http://www.cnblogs.com/igrl/archive/2010/09/17/1829358.html