How To Install Git on CentOS 6

How To Install Git on CentOS 6

Overview

In this tutorial we’ll learn how to install git on CentOS 6.

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.

Install Git

Update yum metadata before installing git


$ sudo yum check-update

Install git


$ sudo yum install git

Yum will list all packages to be installed.

install git CentOS 6

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 1.7.1

Install Latest Version of Git On CentOS 6

At the time of this writing, the latest stable version of Git is 2.13.3. We can install latest version of Git from Inline with Upstream Stable (IUS) project repository.

Add IUS repository


$ sudo yum install https://centos6.iuscommunity.org/ius-release.rpm

Add IUS repository

This process will also install epel-release package as dependency. Enter y to continue.

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

install latest version of Git on CentOS 6 from IUS repository

Press Y to continue.

Yum needs to import IUS GPG key used to sign packages

import IUS GPG key

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

This is not the latest version up to minor (2.13.3) but pretty recent since it already version 2.13.

Summary

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 6 from IUS repository.

You can start using git to manage your code, configuration or any files that you plan to give version to.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.