How to install the latest version of Git on CentOS 7.x/6.x?

LinuxOperating SystemOpen SourceCentos 7

Installing the latest version of Git on CentOS can be done in many ways. Below are three approaches for the same.

Approach 1

Commands

yum install epel-release
yum remove git
rpm -U https://centos7.iuscommunity.org/ius-release.rpm
yum install git2u
git --version

Output

immukul@192 lib % git --version
git version 2.29.2

Approach 2

Commands

yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc
perl-ExtUtils-MakeMaker
export GIT_VERSION=2.29.2
mkdir /root/git
cd /root/git
wget "https://www.kernel.org/pub/software/scm/git/git-2.29.2.tar.gz"
tar xvzf "git-2.29.2.tar.gz"
cd git-2.29.2
make prefix=/usr/local all
make prefix=/usr/local install
yum remove -y git
git --version

Output

immukul@192 git-2.29.2 % git --version

git version 2.29.2

Approach 3

Commands

sudo yum -y install

https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-1.7-1.x86_64.rpm
sudo yum install git

git --version

Output

immukul@192 git-2.29.2 % git --version

git version 2.29.2
raja
Published on 30-Jul-2021 08:44:57
Advertisements