Linux-安装git及秘钥生成

在Linux系统上安装Git

前言

Git是目前流行的非常好用的版本控制工具,这里介绍安装和生成秘钥

1. yum安装git

在Linux上是有yum安装Git,非常简单,只需要一行命令

1
yum -y install git
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.......
.......
.......
.......
(4/5): git-core-doc-2.27.0-1.el8.noarch.rpm 15 MB/s | 2.5 MB 00:00
(5/5): git-core-2.27.0-1.el8.x86_64.rpm 22 MB/s | 5.7 MB 00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 33 MB/s | 8.5 MB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : git-core-2.27.0-1.el8.x86_64 1/5
Installing : git-core-doc-2.27.0-1.el8.noarch 2/5
Installing : perl-Error-1:0.17025-2.el8.noarch 3/5
Installing : perl-Git-2.27.0-1.el8.noarch 4/5
Installing : git-2.27.0-1.el8.x86_64 5/5
Running scriptlet: git-2.27.0-1.el8.x86_64 5/5
Verifying : git-2.27.0-1.el8.x86_64 1/5
Verifying : git-core-2.27.0-1.el8.x86_64 2/5
Verifying : git-core-doc-2.27.0-1.el8.noarch 3/5
Verifying : perl-Error-1:0.17025-2.el8.noarch 4/5
Verifying : perl-Git-2.27.0-1.el8.noarch 5/5

Installed:
git-2.27.0-1.el8.x86_64 git-core-2.27.0-1.el8.x86_64 git-core-doc-2.27.0-1.el8.noarch perl-Error-1:0.17025-2.el8.noarch perl-Git-2.27.0-1.el8.noarch

Complete!
2. 生成公钥
1
2
3
4
5
ssh-keygen -t rsa -C "xxxxx@xxxxx.com"  #-C注释为了区分秘钥,也可以不写

# Generating public/private rsa key pair...
# 三次回车即可生成 ssh key

查看生成的公钥

1
2
cat ~/.ssh/id_rsa.pub