How to use the latest Git on CentOS 7

Hello.
I'm Mandai, the Wild team member in charge of development.

When I installed Visual Studio Code on CentOS 7, it complained about an outdated version of git, so I angrily tried installing the latest version.

The git version available for installation via yum on CentOS 7 is 1.8.
Unfortunately, it seems my relationship with yum-based git ends here.

If you want a later version of git, the only way to do this currently seems to be to install it from source

It would be great if we could set up a repository server beyond these official repositories to cover the parts that are not covered and be of some use to the public

Putting aside that complaint (or whatever it is),
the libraries needed to install Git can be installed using yum, so let's quickly get them all together.

yum install openssl-devel curl-devel expat-devel

The latest git source is available on github, so you can get it by git clone

As an aside, to compile git, you don't need to run ./configure (in fact, it doesn't exist), so if you start without reading the instructions carefully, you might be confused

The correct answer is, "Just make it right away."

make prefix=[/path/to/install] install [install-doc install-html] #install-doc etc. as you like

The prefix should specify the installation path.
It's that thing like /usr or /usr/local.

After specifying the path, simply selecting "install" proceeded to compilation and installation.
I suspected it might be related to documentation, so I deliberately installed it without it.
This was just to confirm that this kind of approach is possible.

Now we have the latest git environment

And they lived happily ever after

 

Wait a minute!

I found an interesting sentence on the official website's download page

Red Hat Enterprise Linux, Oracle Linux, CentOS, Scientific Linux, et al.
RHEL and derivatives typically ship older versions of git. If you cannot (or don't want to) compile git from source, you may need to use a 3rd-party repository such as the IUS Community Project to obtain a more recent version of git.

Hmmm...?

I have a bad feeling about this, but firstIUSlet's check out this

Since this is an English page, my understanding might be inaccurate, but I believe this is a repository of the latest versions of open-source software compiled by volunteers.
(This is a very simplified explanation.)

the Packages - IUSI searched around

Since RPMs are provided for each component, it seems you actually need to collect the packages you need.
So, I'll try downloading the minimum packages required to install 2.11.

wget https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/git2u-2.11.0-1.ius.centos7.x86_64.rpm wget https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/git2u-perl-Git-2.11.0-1.ius.centos7.noarch.rpm wget https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/git2u-core-2.11.0-1.ius.centos7.x86_64.rpm wget https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/git2u-core-doc-2.11.0-1.ius.centos7.x86_64.rpm sudo yum install git2u-perl-Git-2.11.0-1.ius.centos7.noarch.rpm git2u-2.11.0-1.ius.centos7.x86_64.rpm git2u-core-2.11.0-1.ius.centos7.x86_64.rpm git2u-core-doc-2.11.0-1.ius.centos7.x86_64.rpm

Run the downloaded rpms in yum

I was able to install it in no time!

 

Upon further investigation

It seems you can register the repository published by IUS with yum.
This site explains it in detail, so if you're someone who always wants the latest version (like me), why not give it a try?

Add IUS to the yum repository for CentOS 7.1 64-bit | kakiro-web

When I searched for "latest version of git", every site said "you have to install from source", so I installed from source, but I need to do some more research

That's all

If you found this article helpful,please give it a "Like"!
0
Loading...
0 votes, average: 0.00 / 10
1,690
X Facebook Hatena Bookmark pocket

The person who wrote this article

About the author

Yoichi Bandai

My main job is developing web APIs for social games, but thankfully I'm also given the opportunity to work on various other tasks, including marketing.
My image rights within Beyond are treated as CC0.