ubuntu 18.04 上安装git

1,040 阅读1分钟

直接执行命令:

apt install git

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

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 包列表:

apt-get update -y
apt-get upgrade -y

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

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

阅读原文:小鑫の随笔