Compile and install git source code under linux environment

Today I want to install a git on Linux, but the version that comes with the system does not meet my needs, so I plan to install the latest version of git.

step1: install dependencies

yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

Insert picture description here

step2: download the latest version of git

wget https://github.com/git/git/archive/v2.28.0.tar.gz -C /usr/local

step3: unzip

cd /usr/local && tar -xf git-2.28.0.tar.gz && cd git-2.28.0 

step4: compile

make prefix=/usr/local/git all

step5: install

make prefix=/usr/local/git install

step6: configure environment variables

echo 'export GIT_HOME=/usr/local/git' >> /etc/profile
echo 'export PATH=$GIT_HOME/bin:$PATH'   >> /etc/profile
source /etc/profile

step7: Check whether the installation is successful

git --version

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44729138/article/details/108342538