Update Git to the latest (help)

Issues related to applications and software problems
Post Reply
shanedora
Posts: 18
Joined: 2018/10/17 21:40:17

Update Git to the latest (help)

Post by shanedora » 2018/10/22 22:03:39

Environment:
<uname -a>
Linux eve 4.19.0-1.el7.elrepo.x86_64 #1 SMP Mon Oct 22 10:40:32 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux

How do I update my current version (v1.8) of Git to the latest? I've found a few different questions like this on Stack Overflow. https://stackoverflow.com/questions/218 ... os-7-x-6-x

However, there's so many "if...else if...else if..." kind of talk going on I have no idea what to do. One post suggests using this WANDisco's repository and another person is saying to use a rpm repo. It goes on into saying if you have version 1.8 there's something special you need to execute from the command line. Most of these descriptions are very poorly explained from a newbie standpoint. Would someone be so kind in helping me understand each command that is needed to do the following...

Install the latest version of Git

Ensure that whenever I do <sudo yum update> I'm bringing in updates from Git. Also how does this work? Where is this magical file that allows me to enter a repo url and make <yum> use it every time I do <yum update>. Is there something I should be aware of that can get a person into trouble with conflicting repositories or whatever?

Lastly, help me delete the old version of Git. How is this done? Where is Git installed and how do I ensure I'm not deleting the new Git I installed above?

User avatar
remirepo
Posts: 447
Joined: 2014/09/21 09:07:12
Location: France
Contact:

Re: Update Git to the latest (help)

Post by remirepo » 2018/10/23 06:40:43

git 2.9 is available as Software Collections (rh-git29) in centos-sclo repository
See https://wiki.centos.org/AdditionalResou ... tories/SCL
Remi's Repository - Forum - Blog

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Update Git to the latest (help)

Post by TrevorH » 2018/10/23 09:54:38

The IUS repo also packages replacement git packages

Code: Select all

git2u.x86_64                                           2.16.5-1.ius.centos7                                        ius     
I'm also wondering if you phrased this bit right or if you have a misunderstanding about how stuff works:
Ensure that whenever I do <sudo yum update> I'm bringing in updates from Git.
Did you mean "updates TO git"? Because yum doesn't pull updates from git, it looks at yum repos, nothing to do with git at all. Now updates TO git packages come from the yum repos so when e.g. IUS updates theirs then yum will update them for you.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

shanedora
Posts: 18
Joined: 2018/10/17 21:40:17

Re: Update Git to the latest (help)

Post by shanedora » 2018/10/23 17:44:58

@TrevorH ~ I appreciate your attention to detail in how I word things as it's very helpful. I believe there's a slight misunderstanding on my end but I do follow your explanation.

My misunderstanding is mainly on the following two commands. I've tried these and I'm able to update the latest now but there's still some confusion (on my part) as to what the following "actually" does.

Code: Select all

yum install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm
yum update git
Why do I need to <yum install ...> git again with the first command above? Git already exists (even though it's old) on my system so installing it a second time makes no sense to me. Did this "wandisco" not exist before?

I didn't realize I could specify certain packages to update like this (yum update packageName). It is my understanding I've installed Git "again" along side of an existing installed git (the older version). Perhaps my understanding of what the first command does is wrong?! If not, how does yum know which installed git should be updated from issuing the second command above? How can I delete the old version?

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Update Git to the latest (help)

Post by TrevorH » 2018/10/23 19:06:28

Your first command installs package that sets up a new yum repo - one I've never heard of and is not our recommended list. The second command then updates the git package and finds a newer version in the new repo that you just installed.

We don't generally recommend third party yum repos that replace packages from CentOS repos. This wandisco thing is doing that. Having added that repo, you will now get any other updates to any other packages that they provide that are newer than ours. This is one reason why we tend to recommend IUS as a replacement since they name their packages differently (git2u vs git in this case) so adding their repo will not automatically replace CentOS supplied packages. You have to specifically install their replacement and (for the ones I've used) they conflict with the original so you cannot have both installed.

Also, WHY are you doing this anyway? CentOS packages may be old but they are stable and that's the main advantage of CentOS. Stuff doesn't change on a developer's whim, it stays the same for the entire 10 year lifespan of the distro. Security updates are then backported by Redhat to their versions of the packages so things stay secure.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

shanedora
Posts: 18
Joined: 2018/10/17 21:40:17

Re: Update Git to the latest (help)

Post by shanedora » 2018/10/23 20:50:58

There are a small set of features in git version 2.17 I want (hate to be "that guy" but I want to stay up to date). If you really want an explanation I'm giving an interactive presentation on Git to my company and I would like to show some differences between older versions and new versions of Git. Do you recommend I...

1) yum remove git
2) remove the wandisco repo
3) Install the git you mentioned while adding the IUS repo for updates?
Last edited by shanedora on 2018/10/23 20:59:52, edited 1 time in total.

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Update Git to the latest (help)

Post by TrevorH » 2018/10/23 20:58:42

I have no idea who or what wandisco is so personally, I'd use IUS.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Update Git to the latest (help)

Post by jlehtone » 2018/10/24 10:52:46

TrevorH wrote:
2018/10/23 19:06:28
CentOS packages may be old but they are stable and that's the main advantage of CentOS. Stuff doesn't change on a developer's whim, it stays the same for the entire 10 year lifespan of the distro.
The SCL (Software Collections) packages that were already mentioned, do have shorter lifetime (3y?).

Their packages are named differently (just like IUS does), but the binaries have identical names.
You determine the available toolset version(s) in each shell session with 'scl' utility (rather similar ideology as in Environment Modules system).

You can do:

Code: Select all

$ sudo yum install centos-release-scl-rh
$ sudo yum install rh-git29
$ scl enable rh-git29 bash
Now you have bash that finds "the other git":

Code: Select all

$ git --version
git version 2.9.3
$ exit
exit
$ git --version
git version 1.8.3.1
There are more in the repo. To see packages, whose name starts with 'rh-git29':

Code: Select all

$ yum list rh-git29\*
Similarly, once the IUS repo is installed/enabled, you can list:

Code: Select all

$ yum list git\*
(That should list both 'base' and 'IUS' packages, for git2u* starts with 'git' too.)

You don't have to remove repo configuration:

Code: Select all

sudo yum-config-manager --disable centos-sclo-rh
disables repo. Then you can still explicitly use that repo:

Code: Select all

sudo yum --enablerepo=centos-sclo-rh install devtoolset-7-toolchain

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Update Git to the latest (help)

Post by TrevorH » 2018/10/24 11:14:51

The main difference between SCL and IUS is that SCL's install in parallel with the original set of packages and need special action (scl enable) taken to invoke them. IUS installs replacement but differently named packages that replace the original executable and no special action is required to be able to use them.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply