How to install latest version of Git from source package on Centos 7.x

How to install latest version of Git from source package on Centos 7.x

Note: If the viewing version after installation is not the latest version we installed, please re-execute the following operations

# yum remove -y git
# source /etc/bashrc
# git --version

Step 1. Install dependencies

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

Step 2. Uninstall the old git version (if the rpm package was installed before)

# yum remove git

Step 3. Download & Unzip

# cd /usr/src
# wget https://www.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
# tar -zxvf git-2.9.5.tar.gz

Step 4. Compile and install

# cd git-2.5.0
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
# source /etc/bashrc

Step 5. Check the git version

# git --version
git version 2.9.5

refer to:

https://github.com/git/git/blob/master/INSTALL
http://stackoverflow.com/questions/21820715/how-to-install-latest-version-of-git-on-centos-6-x-7-x
https://my.oschina.net/antsky/blog/514586

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325114900&siteId=291194637