Git has released 1.9.5 version on Dec 18, 2014. Git is a free and open source distributed version control system. It is designed to handle a small to very large projects with speed and efficiency. To know more about Git 1.9.5 read Git release notes. This article will guide you to install Git 1.9.5 on CentOS/RHEL 7/6, Fedora 27,26 Systems using the source code. To learn about Git, access Git console on your browser and know about its uses.
Use this tutorial for installing latest Git on your Redhat based systems.
Step 1 – Install Required Packages
Before compiling Git from source code, make sure you have installed required packages on your system or Use the following command to install it.
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
Step 2 – Download and Compile Git Source
Download latest Git source code from Git google code or simply use following command to download Git 1.9.5.
cd /usr/src wget https://www.kernel.org/pub/software/scm/git/git-1.9.5.tar.gz tar xzf git-1.9.5.tar.gz
After downloading and extracting Git source code, Use the following command to compile the source code.
cd git-1.9.5 make prefix= /usr/src/git allmake prefix= /usr/src/git installecho "export PATH=$PATH: /usr/src/git /bin" >> /etc/bashrcsource /etc/bashrc
Step 3 – Check Git Version
Upon completion of above steps, you have successfully install Git in your system. Let use following command to check git version
git --version git version 1.9.5
12 Comments
Hi, I tried to install git 1.9.1 version according to the steps from above on CentOs 6 32bit on virtualBox. At the end when I tried to run git –version I got error message: – bash: command git not found. I tried the last two commands with sudo command, but nothing change.
echo “export PATH=$PATH:/usr/local/git/bin” >> /etc/bashrc
source /etc/bashrc
I don’t know what ‘source’ command is doing, and I don’t know why I don’t get the wrong result at the end. On the previous steps, I don’t get any visible error(s).
wonderful, thanks for the article.
Hi, I followed your instructions but the version of git i get is 1.7.3.4… I am using a redHat 6.6.
Great article, u save me lot of time, on aruba cloud centos !! Yum get me git_1.7.1 very old !!! with this article I installed git_2.1.1 😉 thanks
@Jason
first read, then understand, then write
“#echo “export PATH=$PATH:/usr/local/git/bin” >> /etc/bashrc” gives:
“bash: /etc/bashrc: Permission denied”
sudo before #echo…. superuser have all permissions ! 😉
Thanks for this post!!!. Works like a charm.
Thanks for the tutorial.
Can you please post instructions on how to upgrade existing git as well. I have git 1.7.1 installed in centos 6.5 (/usr/bin/git). I want to replace that version with 1.9.0
Thanks
Vaidya, I had a similar issue.
I found that simply running “yum remove git” took the factory fitted 1.7.1 off the system.
After that when I ran “git –version” it automatically showed version 1.9.0
Thanks for the tutorial.
As my environment was very clean, I was missing 2 dependencies required for the compilation on cent os 6.5.
You can add them in step 1: gcc and perl-ExtUtils-MakeMaker
Thanks Nikolay.
We have updated article accordingly.