In this tutorial we’ll learn how to install git on CentOS 7.
Git is a free and open source distributed version control system (VCS) designed to handle all project from small to large with speed and efficiency.
Originally created by Linus Torvalds in 2005 and maintained by Junio Hamano since July 2005.
You can visit git website to learn more about git usage.
Let’s start installing git on CentOS 7
Update yum metadata before installing git
$ sudo yum check-update
$ sudo yum install git
Yum will list all packages to be installed.
Press Y to install the listed packages.
Yum will import GPG key used to sign the package.
Press Y to import the GPG key.
Git will be install, to check git version installed you can use command below.
$ git version git version 18.104.22.168
Install Latest Version of Git On CentOS 7
At the time of this writing, the latest stable version of Git is 2.14.1.
We can install latest version of Git from Inline with Upstream Stable (IUS) project repository.
Add IUS repository
$ sudo yum install https://centos7.iuscommunity.org/ius-release.rpm
This process will also install epel-release package as dependency. Enter y to continue.
Error: git2u-perl-Git conflicts with perl-Git-22.214.171.124-12.el7_4.noarch Error: git2u-core conflicts with git-126.96.36.199-12.el7_4.x86_64 Error: git2u conflicts with git-188.8.131.52-12.el7_4.x86_64 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
To install git from IUS repository we need to remove git package that we already installed since we cannot install both git from CentOS repository and IUS repository at the same time
$ sudo yum remove git
Now let’s install latest version of git from IUS repository.
$ sudo yum install git2u
yum will list all packages to be installed
Press Y to continue.
Yum needs to import IUS GPG key used to sign packages
Press Y to import GPG key and continue installation.
Git installed from IUS repository. To check git version we can use command below.
$ $ git version git version 2.14.1
In this tutorial we learned how to install git from CentOS repository. We also learn how to install the latest version of Git on CentOS 7 from IUS repository.
You can start using git to manage your code, configuration or any files that you plan to give version to.