http://www.cnblogs.com/igrl/archive/2010/09/17/1829358.html
1. 安装git,从程序目录打开 "Git Bash"
2. 键入命令:ssh-keygen -t rsa -C "[email protected]"
"[email protected]"是github账号
3. 提醒你输入key的名称,输入如id_rsa
4. 在C:\Documents and Settings\Administrator\下产生两个文件:id_rsa和id_rsa.pub
5. 把4中生成的密钥文件复制到C:\Documents and Settings\Administrator\.ssh\ 目 录下。
6. 用记事本打开id_rsa.pub文件,复制内容,在github.com的网站上到ssh密钥管理页面,添加新公钥,随便取个名字,内容粘贴刚
才复制的内容。
7. ^_^ OK了
需要注意步骤2中产生的密钥文件在当前用户的根目录,必须把这两个文件放到当前用户目录的“.ssh”目录下才能生效。
在windows中只能在命令行下输入创建"."开头的文件夹。命令为 mkdir .ssh
[email protected] xxx~
$ ssh-keygen -t rsa -C "[email protected]"(git账号)
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/xxxx/.ssh/id_rsa):(保存地址)
Created directory ‘/c/Users/xxx/.ssh‘.
Enter passphrase (empty for no passphrase):(输入key的名称)
Enter same passphrase again:(重复输入key的名称)
Passphrases do not match. Try again.(输入不一致,重复输入)
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/xxxx/.ssh/id_rsa.(保存地址)
Your public key has been saved in /c/Users/xxxxx/.ssh/id_rsa.pub.(保存地址)
The key fingerprint is:
SHA256:xxxx [email protected]
The key‘s randomart image is:
xxxx