0%

Windows 10环境生成Github SSH公钥

不管是 Windows 还是 Linux,想要不输入用户名和密码操作 Git,只需要把 id_rsa.pub 公钥复制粘贴到 Github 里面就行了。

安装git

打开 Git Bash

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ ssh-keygen -t rsa -C "simon@finolo.gy"

Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/simon/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/simon/.ssh/id_rsa.
Your public key has been saved in /c/Users/simon/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:epRQbzd91E6aLp3aM+ym2FEZMgLNCkA108nb5lsk7CM simon@finolo.gy
The key's randomart image is:
+---[RSA 3072]----+
| .oo+oo+ o|
| .++oo . .o|
| .. =+ = o=.|
| .oo=o.+o+.|
| S+ o oo. |
| oE + o.+ |
| . .. +.= |
| . .o..* |
| . o+.o |
+----[SHA256]-----+

这个邮箱可以随便输入的,并不需要是 Github.com 的登录帐户。

拷贝 id_rsa.pub 内容到 Github

Settings -> SSH and GPG keys -> New SSH key

把前面生成的 /c/Users/simon/.ssh/id_rsa.pub 文件内容粘贴上去就可以了。