环境配置

设置用户签名

配置用户名: git config –global user.name 你的用户名
配置邮箱: git config –global user.email 注册的邮箱

配置好之后,可以用git config –global –list命令查看配置是否OK

1
2
3
$ git config --global --list
user.name=xxx
user.email=xxx@163.com

设置sshKey

生成新的rsa密钥:ssh-keygen -t rsa -C ‘注册GitHub的邮箱’

1
ssh-keygen -t rsa -C xxx@163.com

一直回车就可以,即不设置密码。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ ssh-keygen -t rsa -C xxx@163.com
Generating public/private rsa key pair.
Enter file in which to save the key (/home/king/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/king/.ssh/id_rsa
Your public key has been saved in /home/king/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:n+yyy xxx@163.com
The key's randomart image is:
+---[RSA 3072]----+
| .*=.+. |
| = +=o= o |
| * ++ o . |
| o . o.. . |
| o * . S o |
|. X o o = + |
| + + .. = * |
|..o . o E |
|.o== . |
+----[SHA256]-----+

此时已经生成了ssh ras的密钥:

1
2
$ ls $HOME/.ssh
authorized_keys id_rsa id_rsa.pub known_hosts

设置github的SSH key

img

img_1

img_2

将上面生成的ssh公钥复制进去。

img_3