Skip to content

Instantly share code, notes, and snippets.

@matthewriley
Created June 15, 2016 18:59
Show Gist options
  • Save matthewriley/b74fa53594db1354e5593994c5d5b5a4 to your computer and use it in GitHub Desktop.
Save matthewriley/b74fa53594db1354e5593994c5d5b5a4 to your computer and use it in GitHub Desktop.
Install Git 2.9.0 from source on RHEL 7.x

Install Git 2.9.0 from source on RHEL 7.x

These are the Terminal commands I recently used (June 2016) to install Git 2.9.0 from source on RHEL 7.x. I ran this in a VirtualBox VM after a fresh install from the ISO.

You mileage will vary as the yum packages are updated over time. The yum install line below should include all the dependencies, at least it did for me. Depending upon how often you use yum update you may need to run yum --enablerepo=base clean metadata as su before you run the following commands.

cd ~/Downloads
su
yum install autoconf cpio curl-devel expat-devel gcc gettext-devel make openssl-devel perl-ExtUtils-MakeMaker zlib-devel
wget -O v2.9.0.tar.gz https://github.com/git/git/archive/v2.9.0.tar.gz
tar -xzvf ./v2.9.0.tar.gz
cd git-2.9.0/
make configure
./configure --prefix=/usr/local/git
make && make install
ln -sv /usr/local/git/bin/* /usr/bin/
exit

At this point you can safely remove the git tar file and git directory from your Downloads directory. Git should now be configured according to the following:

$ which git
/usr/bin/git

$ git --version
git version 2.9.0
@jacoulter
Copy link

Works great - thank you!

@jcoryatjr
Copy link

This worked perfectly. The one addition if you are upgrading is to use this command when you update your symbolic links:

ln -svf /usr/local/git/bin/* /usr/bin/

Otherwise it will fail because the links already exist from your current version.

@kumravib
Copy link

kumravib commented Apr 1, 2019

It is working perfectly.

@marciodf
Copy link

After a long time trying to update my RHEL 7.5 with git, finally done!! Many thanks!!!

@SolomonLin
Copy link

I don't have root password, so I can't use the command su. Could you have a version that uses sudo?

@Donut3228
Copy link

I don't have root password, so I can't use the command su. Could you have a version that uses sudo?

Just use sudo su

@dewens12
Copy link

dewens12 commented May 1, 2021

it worked

@johan-boule
Copy link

johan-boule commented Jul 28, 2024

Don't do --prefix=/usr/local/git, this makes no sense. Choose /opt/git instead.
Also don't do put your symlinks in /usr/bin, put them in /usr/local/bin.
Read the FHS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment