You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

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

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 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

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.

 Package                                      Arch                         Version                                 Repository                      Size
 git                                          x86_64                       2.24.1-1.ep7                            endpoint                       139 k
Installing for dependencies:
 emacs-filesystem                             noarch                       1:24.3-23.el7                           base                            58 k
 git-core                                     x86_64                       2.24.1-1.ep7                            endpoint                       5.1 M
 git-core-doc                                 noarch                       2.24.1-1.ep7                            endpoint                       2.4 M
 libsecret                                    x86_64                       0.18.6-1.el7                            base                           153 k
 pcre2                                        x86_64                       10.23-2.el7                             base                           201 k
 perl                                         x86_64                       4:5.16.3-295.el7                        base                           8.0 M
 perl-Carp                                    noarch                       1.26-244.el7                            base                            19 k
 perl-Encode                                  x86_64                       2.51-7.el7                              base                           1.5 M
 perl-Error                                   noarch                       1:0.17020-2.el7                         base                            32 k
 perl-Exporter                                noarch                       5.68-3.el7                              base                            28 k
 perl-File-Path                               noarch                       2.09-2.el7                              base                            26 k
 perl-File-Temp                               noarch                       0.23.01-3.el7                           base                            56 k
 perl-Filter                                  x86_64                       1.49-3.el7                              base                            76 k
 perl-Getopt-Long                             noarch                       2.40-3.el7                              base                            56 k
 perl-Git                                     noarch                       2.24.1-1.ep7                            endpoint                        47 k
 perl-HTTP-Tiny                               noarch                       0.033-3.el7                             base                            38 k
 perl-PathTools                               x86_64                       3.40-5.el7                              base                            82 k
 perl-Pod-Escapes                             noarch                       1:1.04-295.el7                          base                            51 k
 perl-Pod-Perldoc                             noarch                       3.20-4.el7                              base                            87 k
 perl-Pod-Simple                              noarch                       1:3.28-4.el7                            base                           216 k
 perl-Pod-Usage                               noarch                       1.63-3.el7                              base                            27 k
 perl-Scalar-List-Utils                       x86_64                       1.27-248.el7                            base                            36 k
 perl-Socket                                  x86_64                       2.010-5.el7                             base                            49 k
 perl-Storable                                x86_64                       2.45-3.el7                              base                            77 k
 perl-TermReadKey                             x86_64                       2.30-20.el7                             base                            31 k
 perl-Text-ParseWords                         noarch                       3.29-4.el7                              base                            14 k
 perl-Time-HiRes                              x86_64                       4:1.9725-3.el7                          base                            45 k
 perl-Time-Local                              noarch                       1.2300-2.el7                            base                            24 k
 perl-constant                                noarch                       1.27-2.el7                              base                            19 k
 perl-libs                                    x86_64                       4:5.16.3-295.el7                        base                           689 k
 perl-macros                                  x86_64                       4:5.16.3-295.el7                        base                            44 k
 perl-parent                                  noarch                       1:0.225-244.el7                         base                            12 k
 perl-podlators                               noarch                       2.5.1-3.el7                             base                           112 k
 perl-threads                                 x86_64                       1.87-4.el7                              base                            49 k
 perl-threads-shared                          x86_64                       1.43-6.el7                              base                            39 k

Transaction Summary
Install  1 Package (+35 Dependent packages)

Total download size: 20 M
Installed size: 78 M
Is this ok [y/d/N]:y

Check git version after installing git2u-all package

$ git --version
git version 2.24.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.27.0"
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.27.0

Git learning courses:

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

As an appreciation for the content we put out,
we would be thrilled if you support us!

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.


Please enter your comment!
Please enter your name here