Home > Enterprise >  How to update git version on RHEL?
How to update git version on RHEL?

Time:10-12

I just created a fresh RHEL VM on GCP to play some Kubernetes on it.

It was not having any git installed on it.

I used yum package manager to install git on it, but it didn't installed the latest version of git.

Current Version: 2.38.0 / 3 October 2022

Version Installed by yum: 1.8.3.1

CodePudding user response:

Red Hat Enterprise Linux, Oracle Linux, CentOS, Scientific Linux, et al. RHEL and derivatives typically ship older versions of git. You can download a tarball and build from source, or use a 3rd-party repository such as the IUS Community Project to obtain a more recent version of git.

CodePudding user response:

Create a file:

touch gitupgrade.sh

And add the following to it:

yum -y remove git
yum -y clean packages
mkdir tempgit
cd tempgit
yum install -y autoconf cpio curl-devel expat-devel gcc gettext-devel make openssl-devel perl-ExtUtils-MakeMaker zlib-devel
wget -O v2.24.1.tar.gz https://github.com/git/git/archive/v2.24.1.tar.gz
tar -xzvf ./v2.24.1.tar.gz
cd git-2.24.1/
make configure
./configure --prefix=/usr/local/git
make && make install
ln -sf /usr/local/git/bin/* /usr/bin/
cd ..
rm -fr git-2.24.1
cd ..
rm -fr tempgit
echo "results"
which git
git --version

The run it to upgrade:

sudo sh gitupgrade.sh

And that’s a wrap

  •  Tags:  
  • git
  • Related