This guide is for installing the latest release of Git on CentOS 7 server. The git version available on CentOS 7 repository is a bit old, 1.x. If you need a newer version of Git, then use this guide to install it.

install latest git centos 7

Git is a distributed version control system used to track file changes to coordinate work on those files among team members. Git is the most widely used version control system in the world today.

Start by checking installed version of git on your CentOS 7 server.

$ git --version
git version 1.8.3.1

Install Latest git on CentOS 7 from End Point repository

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.

Remove old git

sudo yum -y remove git
sudo yum -y remove git-*

Add End Point CentOS 7 repo

The quickest way of installing the latest version of Git on CentOS 7 is from the End Point repository.

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

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

sudo yum install git

Hit the y key to accept installation then install git on CentOS 7.

Dependencies Resolved

==================================================================================================================================================================
 Package                                     Arch                              Version                                  Repository                           Size
==================================================================================================================================================================
Installing:
 git                                         x86_64                            2.30.1-1.ep7                             endpoint                            135 k
Installing for dependencies:
 emacs-filesystem                            noarch                            1:24.3-23.el7                            base                                 58 k
 git-core                                    x86_64                            2.30.1-1.ep7                             endpoint                            4.9 M
 git-core-doc                                noarch                            2.30.1-1.ep7                             endpoint                            2.6 M
 pcre2                                       x86_64                            10.23-2.el7                              base                                201 k
 perl-Git                                    noarch                            2.30.1-1.ep7                             endpoint                             52 k

Transaction Summary
==================================================================================================================================================================
Install  1 Package (+5 Dependent packages)

Total download size: 7.9 M
Installed size: 37 M
Is this ok [y/d/N]: y

Check git version after installing git2u-all package

$ git --version
git version 2.30.1

As confirmed, the current version of Git is 2.16.5

Install Latest Git (2.x) from source on CentOS 7

In this method, you’ll be tasked with building git from source code. Install dependency packages required:

sudo yum -y install epel-release
sudo yum -y groupinstall "Development Tools"
sudo yum -y install wget perl-CPAN gettext-devel perl-devel  openssl-devel  zlib-devel curl-devel expat-devel  getopt asciidoc xmlto docbook2X
sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi

Download and install latest git:

sudo yum -y install wget
export VER="2.32.0"
wget https://github.com/git/git/archive/v${VER}.tar.gz
tar -xvf v${VER}.tar.gz
rm -f v${VER}.tar.gz
cd git-*
make configure
sudo ./configure --prefix=/usr
sudo make
sudo make install

Check new version of git installed on your system

$ git --version
git version 2.32.0

Git Learning Video Courses

You should now have the latest release of Git 2.x installed on your CentOS 7 server.

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

LEAVE A REPLY

Please enter your comment!
Please enter your name here