Installing a recent copy of git

From WilliamsNet Wiki
Jump to navigation Jump to search

The git version available on CentOS 7 repository is a bit old, 1.x. Unfortunately, there isn't an 'official' way to get a modern version of git -- which is sometimes needed for compatibility with other packages.

There are two community supported repos that provide a modern version of git: IUS and End Point (see Centos Repos for more information). First, you need to remove the default copy of git so there is no confusion:

sudo yum remove git\*

Then you can use one of the two repos to install a newer version.

IUS[edit]

End Point Package Repository[edit]

Endpoint is a community project that provides RPM packages for newer versions of select software for Enterprise Linux distributions. The aim of the project is to create high-quality RPM packages for Red Hat Enterprise Linux (RHEL) and CentOS.

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

Once repository is added, install Git 2.x on CentOS 7:

sudo yum install git

... or ...

sudo yum install git-all

Check git version after installing git2u-all package

git --version