· Travis Rodgers · Programming  · 1 min read

How to Upgrade Git on RHEL7 and CentOS7

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:

shelltouch 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

    Share:

    Related Posts

    View All Posts »