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?

Reza Sanaie
  • 469
  • 1
  • 5
  • 13
  • 1
    How can the Git people possibly speak for the various packagers representing the various Linux distributions. – mdpc Nov 14 '12 at 23:24
  • 5
    How does the statement [It is easiest to install Git on Linux using the preferred package manager](http://git-scm.com/download/linux) 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 '12 at 00: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 . – Stefan Lasiewski Jul 02 '13 at 03: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**'". – Stefan Lasiewski Jul 02 '13 at 03: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. – Ben Collins Apr 29 '14 at 15:55

7 Answers7

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
Reza Sanaie
  • 469
  • 1
  • 5
  • 13
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
muness
  • 109
  • 1
  • 2
  • 4
    RPMForge/RepoForge is a dead project. It is not maintained. DO NOT USE. See also https://github.com/repoforge/rpms/issues/375 Any other repository containing latest git? – Wooff Aug 31 '16 at 07:45
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...

voretaq7
  • 79,345
  • 17
  • 128
  • 213
  • Yes I understand the concept, so what Git has on their website is wrong? "To get 1.8 use yum" ? – Reza Sanaie Nov 14 '12 at 23:01
  • 5
    The Git people cannot speak for the various packagers representing the various Linux distributions. – mdpc Nov 14 '12 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 '12 at 01: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 – Reza Sanaie Nov 15 '12 at 01: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. – Mark Henderson Nov 15 '12 at 01:56
  • CentOS has a new bundle of tools, but it isn't listed under "git", but "devtoolset-2". see my answer – Mark Lakata Jul 17 '14 at 23:21
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.

ceejayoz
  • 32,469
  • 7
  • 81
  • 105
  • 3
    The Git people cannot speak for the various packagers representing the various Linux distributions. – mdpc Nov 14 '12 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 '18 at 08: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

Mark Lakata
  • 243
  • 2
  • 6
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.

PUG
  • 139
  • 4