I like to enable Git "Push to Deploy" on my CentOS 7 server. Currently I only can get Git via yum. I need a newer version.

Do I have to build it from source or is there any repo I can use? I alreay added EPEL and elrepo but yum still gives me Git

  • "Push to deploy" means to use git hooks that get active upon a push. What functionality regarding this are you missing in the EL7 git version? I am successfully using Git 1.7.1 on EL6 for many such tasks.
    – Sven
    Jul 29, 2015 at 15:59
  • 2
    @Sven Based on the need for a newer git version I'd rather say that he is referring to the Git 2.3 "Push to deploy", which allows you to push to a non-bare repository, and also have its working directory updated - github.com/blog/1957-git-2-3-has-been-released
    – andol
    Jul 29, 2015 at 16:24
  • andol is right, I would like to use the "push to deploy" feature that is new with Git 2.3
    – Oliver
    Jul 30, 2015 at 9:27

11 Answers 11


You could use a IUS repository (https://ius.io/) as provided on Git official site here or 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).

Note: some users report that there is no more package called git2u. You can also try packages git222 or git224 in that case.

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

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

Note 2: as reported @alaindeseine in comments there is an issue accessing https://centos7.iuscommunity.org/ius-release.rpm. In that case use https://repo.ius.io/ius-release-el7.rpm

  • 5
    Definitely the method I would use, since you get a well-maintained RPM installed rather than whatever your build tools created. Mar 7, 2017 at 21:19
  • 3
    Just want note that it might not be secure to use 3rd party repos. Here is a blog post dealing with that issue.
    – robsch
    Jun 12, 2017 at 14:47
  • 2
    I got curl: (7) Failed to connect to centos7.iuscommunity.org port 443: Connection timed out on Amazon Linux AMI Does anyone know how to solve it?
    – Van Tho
    Jun 15, 2020 at 7:46
  • 4
    It seems that the new instruction for setting up ius is: ius.io/setup. Also there is no package called git2u anymore. The new name should be git224: yum install git224 works for me.
    – jdhao
    Mar 27, 2021 at 11:39
  • 2
    Works for me, but need to replace rpm -U https://centos7.iuscommunity.org/ius-release.rpm by yum install https://repo.ius.io/ius-release-el7.rpm Apr 20, 2022 at 9:09

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/


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.


What is working for me for CentOS 7:

yum install \
https://repo.ius.io/ius-release-el7.rpm \

yum remove git
yum install git236



Red Hat maintains a software collection for Git 2.9:


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

  • 1
    This is nice but only for x86_64 basearch currently
    – BoeroBoy
    Mar 2, 2020 at 9:14
  • 1
    and how to make scl binaries system wide defaults
    – mmv-ru
    May 9, 2020 at 23:37

These days, a proper git package (not git2u) is available on endpoint:

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

The "Inline with Upstream Stable" (https://ius.io/) repo looks pretty good to me.

It has git 2.x rpms which play nicely with the rpm conflicts system.

You can find git rpms here:


I found the SCL (Software Collections) way to be more cumbersome. They're very careful not to interfere with the user who doesn't use them. A bit over careful in my opinion.


Here are the steps for those who can't use non standard/external repositories on Centos 7.6.

These steps are also suitable to be placed in a Dockerfile (if you don't want to upgrade Centos version)

yum update -y
yum install wget which zlib-devel perl-devel -y
wget https://github.com/git/git/archive/v2.26.2.tar.gz -O /tmp/git.tar.gz
cd /tmp && tar -zxf git.tar.gz
cd /tmp/git-2.26.2
make configure
# ./configure # to overwrite your existing git and YUM managed git locations
./configure --prefix=/usr/local # standard way
make install
whereis git

If somebody is looking for an ansible script running on RHEL7:

    - name: Remove build-in GIT
        name: git
        state: absent
      become: true      

    - name: Download epel-release
        url: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
        dest: ~/epel-release-latest-7.noarch.rpm

    - name: Install epel-release 
        name: epel-release-latest-7.noarch.rpm
        state: present
      become: true

    - name: Download uis-release
        url: https://repo.ius.io/ius-release-el7.rpm
        dest: ~/ius-release-el7.rpm

    - name: Install uis-release
        name: ius-release-el7.rpm
        state: present
      become: true

    - name: Install git 224
        name: git224.x86_64
        state: present
      become: true 

If you are looking for some other git version, check available versions after installing uis-release using

sudo yum list git*
  • 1
    You can give the URL directly to the yum module. You don't need to download it in a separate play. Sep 3, 2021 at 16:09

On RHEL 7.8, I got conflict errors when trying to yum upgrade git (from version 1.8 to 2.24):

Error: git224-core conflicts with git-
Error: git224 conflicts with git-
Error: git224-perl-Git conflicts with perl-Git-
You could try using --skip-broken to work around the problem

To workaround this I used yum shell commands:

$ sudo yum shell
> erase git
> install git224
> run

    git.x86_64 0:                                                                     

  Dependency Removed:
    perl-Git.noarch 0:                                                                

    git224.x86_64 0:2.24.3-1.el7.ius                                                                  

  Dependency Installed:
    git224-core.x86_64 0:2.24.3-1.el7.ius            
    git224-core-doc.noarch 0:2.24.3-1.el7.ius       
    git224-perl-Git.noarch 0:2.24.3-1.el7.ius       

> quit

$ git --version
git version 2.24.3

There is an official, made by RedHat, package with git 2.27 available for both x86_64 and ARM64 available in Software Collections.

You can install it with:

yum install -y centos-release-scl-rh
yum install -y rh-git227-git

Note that by design it is installed under /opt and is not in your PATH by default.

You can easily make it the preferred git binary f.e. with a symlink:

ln -s /opt/rh/rh-git227/root/usr/bin/git /usr/local/bin/git

UPDATE: oups, sorry, while this package is a worth consideration way to go, it’s not that easy to use software collections. You have to enable the collection, I will update the answer later.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.