GitHub设置公钥

GitHub设置公钥在windows下面

1. 安装git,从程序目录打开 "Git Bash" 
2. 键入命令:ssh-keygen -t rsa -C "email@email.com"
  "email@email.com"是github账号
3. 提醒你输入key的名称,输入如id_rsa

如果执行成功。返回

Generating public/private rsa key pair.
Enter file in which to save the key (/home/forwhat.cn/.ssh/id_rsa): 
在这里就是设置存储地址了.反正我是直接按的回车

然后还会返回

Enter passphrase (empty for no passphrase):

再次直接回车。
Enter same passphrase again:

再次回车。

Your identification has been saved in /home/forwhat.cn/.ssh/id_rsa.
Your public key has been saved in /home/forwhat.cn/.ssh/id_rsa.pub.
The key fingerprint is:
这里有一串数。我把他屏蔽了。
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|                 |
|    o            |
|   + .  S        |
|  . = .  o       |
|   o + +o.o      |
|E o . o.=+.      |
|.+   ==+ooo.     |
+-----------------+

4. 在C:Documents and SettingsAdministrator下产生两个文件:id_rsa和id_rsa.pub
5. 把4中生成的密钥文件复制到C:Documents and SettingsAdministrator.ssh 目 录下。
6. 用记事本打开id_rsa.pub文件,复制内容,在github.com的网站上到ssh密钥管理页面,添加新公钥,随便取个名字,内容粘贴刚
 
需要注意步骤2中产生的密钥文件在当前用户的根目录,必须把这两个文件放到当前用户目录的“.ssh”目录下才能生效。
原文地址:https://www.cnblogs.com/atlas2016/p/5836979.html