• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Install Git 2.0.5 on CentOS/RHEL 7/6/5 and Fedora 22/21

Written by Rahul, Updated on February 10, 2015
Opensource git, git 2.0, git client, git-scm

Git has released 2.0.5 version on Dec 18, 2014.It has lots of noticeable changes over git 1.9 release. 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 read git release notes.

To Install upgraded version of Git visit Install Git 2.X

git-large-imge

This article will guide you to install Git 2.0.5 on CentOS/RHEL 7/6/5 and Fedora 21/20 and CloudLinux 7 Systems using source code. To learn about Git, access Git console on your browser and know about its uses.

Step 1: Install Required Packages

Firstly we need to make sure that we have installed required packages on your system. Use following command to install required packages before compiling Git source.

# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
# yum install  gcc perl-ExtUtils-MakeMaker

Step 2: Uninstall old Git RPM

Now remove any prior installation of Git through RPM file or Yum package manager. If your older version is also compiled through source, then skip this step.

# yum remove git

Step 3: Download and Compile Git Source

Download git source code from kernel git or simply use following command to download Git 2.0.5.

# cd /usr/src
# wget https://www.kernel.org/pub/software/scm/git/git-2.0.5.tar.gz
# tar xzf git-2.0.5.tar.gz

After downloading and extracting Git source code, Use following command to compile source code.

# cd git-2.0.5
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
# source /etc/bashrc

Step 4. Check Git Version

One completion of above steps, you have successfully install Git in your system. Let use following command to check git version

# git --version

git version 2.0.5

Share it!
Share on Facebook
Share on Twitter
Share on Google+
Share on Reddit
Share on Tumblr
Rahul
Rahul
Connect on Facebook Connect on Twitter Connect on Google+

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

Related Posts

  • How to Rename Local and Remote Git Branch

    February 5, 2019
  • How to Install Gitlab Server on Ubuntu 18.04 & 16.04 LTS

    September 1, 2017
  • How to Setup Commit Username and Email for Git

    June 27, 2017
  • How to Delete Commit History in Github

    March 15, 2017
  • How to List Remote Branches in Git

    September 9, 2016

15 Comments

  1. Guru Reply to Guru
    November 2, 2018 at 4:15 am

    This has worked fine.

    But does it changes the bash_profile in user’s home directory ?
    what does command “source /etc/bashrc” exactly does. ?

    Also, in case if we need to revert the installed git, then what the procedure for it ?.

  2. Bharath Reply to Bharath
    April 16, 2018 at 11:47 am

    Thanks! Was stuck at 1.7.1 with yum update not helping. These steps got me to 2.17 in no time!

  3. Aleksandar Reply to Aleksandar
    February 27, 2018 at 7:49 am

    Thanks man, this really helped me on CentOS 6.9. I was struggling to update it from 1.7.1 to some newer version, and this article helps me to do it in few minutes!

  4. Petr Reply to Petr
    March 15, 2016 at 12:21 pm

    Hi,

    I was looking for a way how to bring latest Git to REHL 6 and there’s another, much easier way. Use Rackspace’s IUS repositories, they have rpms for latest Git version.

    Regards,
    P.

    • Chef Reply to Chef
      May 2, 2016 at 11:28 pm

      Can you include the full command line sequence for doing this, assuming you’re on a system that does not have those repositories?

      • Wyllyam79 Reply to Wyllyam79
        March 27, 2018 at 8:59 pm

        install Rackspace repo: https://support.rackspace.com/how-to/install-epel-and-additional-repositories-on-centos-and-red-hat/

        and then:
        sudo yum install yum-plugin-replace
        sudo yum replace git –replace-with git2u

  5. Jim P. Reply to Jim
    February 14, 2016 at 12:58 am

    Used this to install Git 2.7.1 on HostGator VPS running CentOS 6.5. Worked like a charm. Thank you so much.

  6. Gunita Reply to Gunita
    January 5, 2016 at 6:57 pm

    I did the installation, everything went successfully. But now when I do git –version, it shows version 1.7.1 instead of version 2.0.5

  7. Srinivasan AC Reply to Srinivasan
    October 12, 2015 at 8:49 am

    I am getting below error… Can you help out.. I am trying this on RHEL7

    [[email protected] git-2.5.0]# make prefix=/opt/git all
    CC credential-store.o
    In file included from credential-store.c:1:0:
    cache.h:21:18: fatal error: zlib.h: No such file or directory
    #include
    ^
    compilation terminated.
    make: *** [credential-store.o] Error 1
    [[email protected] git-2.5.0]

    • Josh Sklar Reply to Josh
      October 14, 2015 at 11:53 pm

      Not having the zlib.h file most likely means that you didn’t install the zlib-devel package. Try doing that yum install zlib-devel step again.

  8. Gerard Reply to Gerard
    July 10, 2015 at 12:36 am

    Please ignore previous comment!

  9. Gerard Reply to Gerard
    July 10, 2015 at 12:35 am

    Great article

    You may also want to update to include; yum install openssl-devel

    Cheers

  10. Seemab Reply to Seemab
    July 2, 2015 at 10:59 am

    Hi,

    This is simply amazing, it helps me a lot.
    Simply luv you for this article.

  11. Phila Reply to Phila
    June 4, 2015 at 9:07 am

    Thanks buddy, it worked for me. Much appreciation!!

  12. Simon Smith Reply to Simon
    October 20, 2014 at 11:37 pm

    This worked well, thanks!

    Had to ensure I exported the Git path though. In .bash_profile or other startup dotfile:

    export PATH=$PATH:/usr/local/git/bin

Leave a Reply

Cancel reply

Popular Posts

  • How To Install Zabbix Agent on Debian 9/8
  • How to Install and Configure Squid Proxy on Debian 9
  • How To Install Wine 3 on Debian 9 (Stretch)
  • How to Remove “public/index.php” from URL in Laravel
  • How to Install Swift on Ubuntu 18.04 LTS
All rights reserved. © 2013-2018 TecAdmin.net. This site uses cookies. By using this website you agree our term and services