查看 Linux 发行版名称和版本号
[root@test ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
使用 yum 命令安装 git
sudo yum install git
默认安装的 Git 版本为 1.x 版本,而不是最新2.x
[root@test ~]# git --version
git version 1.8.3.1
升级 Git 2.x
移除 Git 老版本
sudo yum remove git*
添加 CentOS7 仓库地址
sudo yum -y install https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-1.7-1.x86_64.rpm
安装 Git
sudo yum install git
查询 Git 版本
[root@test ~]# git --version
git version 2.30.1
这样 Git 版本就升级成 2.x 了
网友评论