Red Hat Enterprise Linux 7 (RHEL7) comes with git 1.8. And git 1.8 is old and unusable in most situations. So how you do upgrade it. Well, with this script of course.

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 -ft tempgit
echo "results"
which git
git --version

The run it to upgrade:

sudo sh gitupgrade.sh

And that's a wrap

Travis Rodgers

Buy Me a Coffee at ko-fi.com

Hi, I'm the Travis in Travis.Media. I'm a self-taught software developer, blogger, and YouTuber, sharing everything I'm learning along the way.

Show comments