Install Git on Linux
Download the installation package from the git official website
install git
I installed git on CentOS 7.7 64 bit
I upload the downloaded git installation package to the server through Xftp 7
I uploaded the git installation package to the /usr/local/ directory of the service
[root@localhost /]# cd /usr/local/
Unzip the installation package
[root@localhost local]# tar -zxvf git-2.41.0.tar.gz
Install the compilation environment
[root@localhost local]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
When installing the git compilation environment, yum automatically installed git for you, you need to uninstall this old version of git
[root@localhost local]# git --version
git version 1.8.3.1
Uninstall the git that the compilation environment automatically installs for you
[root@localhost local]# yum remove git
First go to your git directory
[root@localhost local]# cd git-2.41.0
Start compiling and installing
[root@localhost git-2.41.0]# make prefix=/opt/git all
[root@localhost git-2.41.0]# make prefix=/opt/git install
Configure environment variables
[root@localhost git-2.41.0]# vim /etc/profile
Add the following variables to the end of the file
export GIT_HOME=/opt/git
export PATH=$GIT_HOME/bin:$PATH
Refresh source after keeping content
[root@localhost git-2.41.0]# source /etc/profile
Check the git version
[root@localhost git-2.41.0]# git --version
git version 2.41.0
success