Install a newer version of Git on CentOS 7

Solution 1:

You could use a IUS repository (https://ius.io/) as provided on Git official site here. It contains prebuilt binaries for x86_64.

To do that, run (as root):

yum install epel-release
yum remove git
rpm -U https://centos7.iuscommunity.org/ius-release.rpm
yum install git2u

(centos7 can be replaced with centos6 or rhel{6,7} if you are not using CentOS).

Another option would be to use another RPM repository (i386 & x86_64):

sudo yum -y install https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-1.7-1.x86_64.rpm
sudo yum install git

Solution 2:

Building from source is quite straightforward. Digital Ocean has a nice guide on building Git from source on CentOS 7. Place the resulting binary in /usr/local/bin/ on your CentOS 7 system (which, by default, is included in your $PATH) and you're good to go.

Of course you would prefer packages/using the repo, however given your situation I would not hesitate building it myself.

For general information; Push to Deploy was introduced in Git 2.3.0. Make sure to use this version or above.


Solution 3:

I have this approach for CentOS 7.2:

rpm -U http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm \
    && yum install -y git

At the moment I have 2.10.0 GIT version.

Or for CentOS 7.1 the same path but wandisco-git-release-7-1.noarch.rpm.

You may inspect available releases http://opensource.wandisco.com/centos/7/git/x86_64/


Solution 4:

Red Hat maintains a software collection for Git 2.9:

https://www.softwarecollections.org/en/scls/rhscl/rh-git29/

This is the easiest and safest way to get Git 2.x on CentOS.

Tags:

Git

Centos7