16

When I go to Gits download section it mentions that latest version is 1.8 and I can install it by yum install git on Fedora. I'm running CentOS6 so that command should also work for me, but yum tells me:

Setting up Install Process
Package git-1.7.1-2.el6_0.1.x86_64 already installed and latest version
Nothing to do

Is my yum pointing to old repositories? Or I'm doing something worng?

Thanks!

EDIT: I understand that vendors are not always up to date with their package list, so does that mean the documentation on git website is incorrect on the fact that they tell me to download it using yum while vendors haven't updated their package lists?

5
  • 1
    How can the Git people possibly speak for the various packagers representing the various Linux distributions.
    – mdpc
    Nov 14, 2012 at 23:24
  • 5
    How does the statement It is easiest to install Git on Linux using the preferred package manager conflict with the idea that you will not be getting the latest-greatest version? It is easiest to install the packaged version of git. Most people don't need the absolute latest version of git. If you want to live on the bleeding edge, then you don't get to choose the easy path. Download the source and build it, or look for a appropriate 3rd party repos where someone else has done the hard work.
    – Zoredache
    Nov 15, 2012 at 0:29
  • Red Hat rarely changes the major version of a software package to maintain stability. Since git is at 1.7.1 today, it may always remain at 1.7.1 (Security fixes are backported in). You're only choice is to install from source or install an RPM from a third party repository. @muness's solution below worked great for me, and now I'm at 1.7.11, which is good enough to support most features I need on github.com . Jul 2, 2013 at 3:00
  • 1
    does that mean the documentation on git website is incorrect -- yes, their website is incorrect. Github.com is a great tool, but their documentation definitely contains mistakes and is ambiguous in some places. Some critics will point out mistakes like this and say, "Oh right, they're 'agile'". Jul 2, 2013 at 3:04
  • Fedora and CentOS aren't the same. They're both based on RedHat Linux, but you can't assume that a given command will always have the same effect on one as the other. Package management in particular is one of the areas of widest divergence. Apr 29, 2014 at 15:55

7 Answers 7

11

It's super easy to download the source and compile it yourself, I even found RPMForge method kind of cumbersome.

Download Git 2.11 source and

    make configure 
    ./configure --prefix=/usr
    make all
    sudo make install install-doc install-html

I needed to install a couple of dependencies before make fully succeeds.

sudo yum install libcurl-devel zlib-devel asciidoc xmlto
4
  • I did this with Git 2.2 source on a fresh CentOS 6 box and had to also install zlib-devel in addition to the libcurl-devel.
    – Brian
    Dec 29, 2014 at 21:50
  • Just tried this on CentOS 6.6, I also needed to yum install asciidoc and xmlto.
    – jfklein
    Feb 16, 2016 at 22:23
  • Thanks, mind updating the answer? Feb 16, 2016 at 22:24
  • If you have GIT already, then you can download the latest version by using this: git clone https://github.com/git/git Sep 21, 2017 at 13:18
10

Here's what worked for me:

  1. Enabled RPMForge
  2. yum install yum-plugin-priorities # install the yum priorities plugin via
  3. Enabled the RPM Forge Extras repo by editing /etc/yum.repos.d/rpmforge.repo and changed enabled to 1 in the rpmforge-extras section. I also bumped up the priority of both rpmforge repos to 1 by adding priority = 1 to both sections.
  4. yum remove git
  5. yum clean all && yum update && yum install git
1
6

Your OS vendor (the CentOS project) may not have built a package for the latest version of git yet (or they may not be planning to, and instead intend to stick with the 1.7.x series in CentOS 6).

Software does not magically appear in packaging systems the day it's released by its author - packages need to be built, tested, approved, and pushed. If you require a version that your upstream vendor isn't shipping you can always build it yourself...

6
  • Yes I understand the concept, so what Git has on their website is wrong? "To get 1.8 use yum" ? Nov 14, 2012 at 23:01
  • 5
    The Git people cannot speak for the various packagers representing the various Linux distributions.
    – mdpc
    Nov 14, 2012 at 23:23
  • 2
    @RezaSanaie Where are you finding that quote on the git (git-scm.com) website. They're much smarter than to make a claim like that. As Zoredache pointed out, they say it's EASIEST to use your OS package manager (to get a version of git). If you need the latest and greatest you should be building it yourself.
    – voretaq7
    Nov 15, 2012 at 1:33
  • 2
    When it says "Latest stable release 1.8.0 Release Notes (2012-10-21) Download for Linux" and I click on it I normally expect to get that Nov 15, 2012 at 1:35
  • 1
    @RezaSanaie - in that case may I suggest that you send Git an email and raise your complaints about how they have worded their website. It won't change the situation but it might clear up future confusion. Nov 15, 2012 at 1:56
1

For stability, enterprise-oriented distributions like CentOS tend to stick with the major release of the tools that was present when the OS was released. Third-party repositories can be used to bump up to higher versions, but it's often not necessary. If Git 1.7 is working nicely for you, you should be fine sticking with it.

2
  • 3
    The Git people cannot speak for the various packagers representing the various Linux distributions.
    – mdpc
    Nov 14, 2012 at 23:22
  • This. Basically when someone uses CentOS or RHEL they often think they decide to use a stable popular-among-enterprises OS. In fact what they decide is: we want no new functionality for any software only security fixes. Super-stable == super-old-functionality.
    – kubanczyk
    Mar 11, 2018 at 8:28
1

CentOS 6 supports a "parallel" universe of newer compilers and tools, that doesn't clobber the older versions. You want

yum install devtoolset-2

Once it is installed, do

scl enable devtoolset-2 bash

which will modify your path. You'll have the old version of git in /usr/bin/git, and the newer version in /opt/rh/..../git. The newer one is 1.8.4/.

You also get newer g++ (4.8), etc.

You'll also want the latest devtoolset-2. Details on devtoolset-2 can be found at another answer: https://superuser.com/questions/381160/how-to-install-gcc-4-7-x-4-8-x-on-centos/676337#676337

1
  • Tantalizing, but not supported on my CentOS 6.5 as installed by my Ops team.
    – MarkHu
    Feb 8, 2016 at 21:04
0

Use the IUS repository (https://ius.io/) as mentioned in the official git website: (https://git-scm.com/download/linux)

Follow these instructions:

rpm -U https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/git2u-all-2.16.2-1.ius.centos7.noarch.rpm && yum install -y git

-1

Step by step guide here. Alot of the solutions require a little bit of time. The refrenced link was the fastest way for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .