Services Spotlight:

Install Latest Version of Git on Fedora

Written By Corlew Solutions
Updated April 7, 2016
Published April 7, 2016
Why Corlew Solutions?

We write great software and provide amazing technical support. Contact us today if you need help with a software project:

  • Website: Send an inquiry
  • Email:
  • Phone: (703) 688-3058

Article Technology Info

This article discusses the following technologies:

  • Fedora - Fedora is an operating system based on the Linux kernel, developed by the Fedora Project and sponsored by Red Hat.
    (website | download | wiki)
  • Git - A free and open source distributed version control system
    (website | download | docs)

Installing the latest version of Git on Fedora takes a little extra work since Fedora doesn’t update the Git version in the package manger very often. Fedora attempts to be extra stable so it doesn’t provide the latest and greatest version of Git in the repositories. It takes a little extra work to download and compile Git yourself, but the process is simple and straightforward. Novice Linux users should be able to complete these instructions in a couple minutes.

Install Git on Fedora Through the Package Manager

First let’s do it the easy way. If you’re ok using an older version of Git (potentially way-older), you can easily install Git through the package manager on Fedora and be done with it.

1
sudo yum install git

Given the frequency that Fedora updates Git in the repositories, you’re going to quickly find yourself out of date with the Git project. The next best option is to download the Git code yourself, compile and install it directly.

Install Git on Fedora by Compiling the Latest Code

Remove the existing version of git if it is installed via the package manager:

1
sudo yum remove git

If you’ve previously installed, a custom version of Git on Fedora and are here to update your version again, you should remove your current version of Git by deleting the git folder inside /usr/src. It might look something like /usr/src/git-2.5.1.

Next, install some preliminary packages so we can compile Git:

1
2
sudo yum install nano curl-devel expat-devel gettext-devel openssl-devel zlib-devel
sudo yum install gcc perl-ExtUtils-MakeMaker

Head over to https://www.kernel.org/pub/software/scm/git/ to find a list of git tarballs that are available to download. The code below shows how to download the 2.8.1 version of Git to your home directory.

1
2
cd ~
wget https://www.kernel.org/pub/software/scm/git/git-2.8.1.tar.gz

Move the tarball you just downloaded to the /usr/src directory.

1
sudo mv git-2.8.1.tar.gz /usr/src

Extract the tarball then delete it.

1
2
3
cd /usr/src
sudo tar xzf git-2.8.1.tar.gz
sudo rm git-2.8.1.tar.gz

Compile and install Git:

1
2
3
cd git-2.8.1
sudo make prefix=/usr/local/git all
sudo make prefix=/usr/local/git install

Become root and add a line to the end of your /etc/bashrc.

1
2
sudo su
echo 'export PATH=$PATH:/usr/local/git/bin' >> /etc/bashrc

Open the above file by executing nano /etc/bashrc and make sure the line was successfully added and it only appears one time. Next, go back to your account and reload the /etc/bashrc file:

1
2
exit
source /etc/bashrc

Verify the new version of git has been installed:

1
git --version

We hope you found this article useful. If you see any mistakes, missing features or ways to improve it, please let us know in the comments below so we can update its contents. If you're willing to link to us, we would sincerely appreciate it!

Corlew Solutions is a Web Design and Web Application Development company based in Fairfax Virginia, minutes away Washington D.C. If you're looking for great web design from the Northern Virginia area or web design from the Washington D.C. area we can help. Contact Us today!

comments powered by Disqus