16

I like to enable Git "Push to Deploy" on my CentOS 7 server. Currently I only can get Git 1.8.3.1 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 1.8.3.1.

  • "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 '15 at 15:59
  • 1
    @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 '15 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 '15 at 9:27
7

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.

21

You could use a IUS repository (https://ius.io/) as provided on Git official site here: https://git-scm.com/download/linux

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

  • 4
    Definitely the method I would use, since you get a well-maintained RPM installed rather than whatever your build tools created. – Ken Williams Mar 7 '17 at 21:19
  • 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 '17 at 14:47
  • @robsch I completely agree with that, and I never will use external repos if required packages would be provided in standard/ofiicial repos. As always, it's a trade off subject. Anyway, we always should follow the "think twice before you do" strategy. – lospejos Jun 12 '17 at 16:03
10

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/

1

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:

https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/repoview/letter_g.group.html

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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