How to install the latest version of GIT on Centos 6.x?

To install the current stable version of git just launch simple command:

yum install git

Probably you could compile even newer version of git from the source. However, the purpose of this tutorial is to show how to install the latest version of git available in the repositories.

Install RPMforge repository following instructions on http://wiki.centos.org/AdditionalResources/Repositories/RPMForge#head-f0...

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm
rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm

If you previously installed RPMforge and now see conflict between el5 and el6 versions then do:

rpm -e rpmforge-release-0.5.2-2.el6.rf.i686
rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm
rm -rf rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

Now let's clean and update yum database and check if we previously installed git and if did then to get rid of it:

yum clean all
yum update
git --version
yum remove git

Now go to /etc/yum.repos.d and temporarily disable "base" and temporarily enable "rpmforge-extras" repository:

cd /etc/yum.repos.d
nano CentOS-Base.repo
nano rpmforge.repo

Now, update yum database and see what kind of git version rpmforge-extras repository offers. Ignore the error about "Error: Package: perl-IO-Compress-2.052-1.el6.rfx.noarch (rpmforge-extras)":

yum update
yum provides git

You will see quite an extensive list:

yum provides git
Loaded plugins: downloadonly, fastestmirror, presto, priorities
Loading mirror speeds from cached hostfile
 * extras: mirror.stanford.edu
 * rpmforge: mirror.hmc.edu
 * rpmforge-extras: mirror.hmc.edu
 * updates: centos.sonn.com
92 packages excluded due to repository priority protections
git-1.7.6-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
Matched from:
 
 
 
git-1.7.8.2-2.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
Matched from:
 
 
 
git-1.7.11.1-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
Matched from:
 
 
 
git-1.7.6.4-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
Matched from:
 
 
 
git-1.7.7.4-2.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
Matched from:
 
 
 
git-1.7.10.1-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
Matched from:
 
 
 
git-1.7.10-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
Matched from:
 
 
 
git-1.7.6.1-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
Matched from:
 
 
 
git-1.7.3.4-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
Matched from:
 
 
 
git-1.7.11.3-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
Matched from:
 
 
 
git-1.7.10.4-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
Matched from:
 
 
 
git-1.7.9.6-1.el6.rfx.x86_64 : Git core and tools
Repo        : rpmforge-extras
Matched from:
 
 
 
git-1.7.11.3-1.el6.rfx.x86_64 : Git core and tools
Repo        : installed
Matched from:
Other       : Provides-match: git

Copy the exact name of needed package, for example install git-1.7.11.3-1.el6.rfx.x86_64, and run:

yum install git-1.7.11.3-1.el6.rfx.x86_64
git --version

Reverse the repositories by enabling Base and disabling rpmforge-extras. You are done!

Comments

On CentOS 6.4 I only added

On CentOS 6.4 I only added rpmforge and used yum --disablerepo=base,updates --enablerepo=rpmforge-extras update git. That worked fine in my installation.

Thank you! It works for me!

Thank you! It works for me!

Thanks, its working.

Thanks, its working.

That almost worked for me.

That almost worked for me. Thank you very much.

I have a CentOS 6.4 server, and following the steps you so kindly provided helped me get the latest Git installed.

However, in my case, I got a missing dependency error (libneon.so.27 64bit). So I re-enabled the CentOS-Base repo, and then things went smoothly. I am just curious: what is the purpose of disabling the Base repo? And, by doing what I did, am I going to face problems in the future because of it?

You are perfectly fine with

You are perfectly fine with going with the version provided by Base repository. The above steps are for those who would like to most updated version of GIT.

You can also do the

You can also do the following, for a more permanent solution:

1. Edit base.repo. Instead of disabling it, add the following line to the base repository config: "exclude=git*"
2. Edit the rpmforge.repo file. Disable rpmforge, enable rpmforge-extras. Add the following line to rpmforge-extras config: "includepkgs=git* perl-Git*"

This worked for me, doesn't pollute my system with random rpmforge packages, and doesn't invasively tamper with the base repo config.

Way to Go! Thanks for this

Way to Go! Thanks for this input!

Thanks! Extremely elegant and

Thanks! Extremely elegant and correct solution.

Thank you! Great tips indeed.

Thank you! Great tips indeed.

does it affect existing git

does it affect existing git repositories?

If you want git 1.8.x RPM I

If you want git 1.8.x RPM I suggest you use 'iuscommunity.org' repository. Follow this document iuscommunity.org/pages/Repos.html#release-packages on how to import repo descriptor onto your system.

Once repository is setup to 'yum install git18'

yum install git

yum install git –disablerepo=rpmforge
not working for me still giving :
Error: Package: git-1.7.12.4-1.el5.rf.x86_64 (rpmforge)
Requires: libcurl.so.3()(64bit)

Enable base repo and install

Enable base repo and install subversion.x86_64 first.

Thank you! It works for me!

Thank you! It works for me!

Post new comment

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
To prevent automated spam submissions leave this field empty.