View the Linux distribution name and version number

[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"Copy the code

Install Git using the yum command

sudo yum install git
Copy the code

The default Git installation is 1.x, not the latest 2.x

[root@test ~]# git -- git version 1.8.3.1Copy the code

To upgrade the Git 2. X

Remove an old Git version

sudo yum remove git*
Copy the code

Add the storage address of CentOS7

Sudo yum -y install https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-1.7-1.x86_64.rpmCopy the code

Install Git

sudo yum install git
Copy the code

Querying the Git Version

[root@test ~]# git version 2.30.1Copy the code

The Git version is now 2.x