ubuntu 18.04 上安装git

直接执行命令:

1
apt install git

安装过程中如果出现了以下错误,需要更新一下 apt 包列表

1
2
3
4
5
6
7
8
9
10
11
12
13
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package git is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'git' has no installation candidate
root@iZ8vbh829ac9d7go2fq5otZ:~# git -V

Command 'git' not found, but can be installed with:

apt install git

更新 apt 包列表:

1
2
apt-get update -y
apt-get upgrade -y

更新之后再 执行 apt install git 安装

最后执行 git --version 检查 git 是否安装成功