How to Install Git on CentOS 7 With Yum or Latest Repository

March 15, 2019

Git released version 2.21 on Feb 24, 2019. This tutorial is for installing the latest version release of Git 2.21 on CentOS/RHEL 7/6.

Git is a form of version control – a critical software configuration management tool. With the benefit of a version control system (VCS), you can track, annotate, and organize changes to documents, websites, computer programs, and many other kinds of collected information.

Let’s walk through the process of installing Git on CentOS 7.

tutorial on centos install git on 7


Option 1: Install Git with Yum

The easiest, fastest way to install Git is with Yum (Yellowdog Updater, Modified), CentOS’s package manager.

Follow these steps to install the latest version of Git on your CentOS 7 server.

1. Find and install the latest version with the command:

yum install git

Let the system finish installing Git.

2. Verify the installation using the command:

git --version

The output should display the version number of Git that you have installed successfully.

For example:  git version 2.21.0

Based on the output above, you have successfully installed Git version 2.21.0 on CentOS.

install git on centos 7

Option 2: Install Latest Version of Git from IUS Repository

If you are seeking a custom range of options, you may prefer to install Git from IUS, a community-run source of quality packages stored in the .rpm file format (RPM packages).

Inline with Upstream Stable (IUS) provides updated versions of the key software for CentOS and Red Hat Enterprise Linux (RHEL).

Note:  You can’t directly upgrade from stock packages to IUS packages.

Step 1: Install Development Tools

Go to your default repositories provided in CentOS, and retrieve the necessary tools to build a binary for the version of Git you plan to install.


sudo yum groupinstall "Development Tools"

Then run this command:

sudo yum install gettext-devel openssl-devel perl-CPAN perl-devel zlib-devel

Step 2: Installation From Source

Install CentOS 7 repo from IUS using the command:

sudo yum install 


sudo yum install git2u-all

Step 3: Verify Installation

Now, you should have the latest version.

Perform a version check for Git on your CentOS 7 server with the command:

git --version 

This ensures you have successfully installed the desired version of Git onto the CentOS 7 server.

For example: git version 2.21.0

Based on the output above, you have successfully installed Git version 2.21.0 on CentOS 7.

Remove Previous Git version with Yum

To remove an old version of Git, use this command:

sudo yum remove git
remove previous git version


Your installation Git on CentOS 7 should be complete! If you are running a newer version of CentOS, check out our article on installing Git on CentOS 8.

Git offers a leading-edge distributed VCS to facilitate collaboration by enabling all parties to annotate, manage, and track file edits.

For Ubuntu, see our guide on installing Git on Ubuntu.

Was this article helpful?
Sofija Simic
Sofija Simic is an experienced Technical Writer. Alongside her educational background in teaching and writing, she has had a lifelong passion for information technology. She is committed to unscrambling confusing IT concepts and streamlining intricate software installations.
Next you should read
How To Rename a Local and Remote Git Branch
April 11, 2024

Git is a version control system that helps you control the stages of software development. It uses named...
Read more
How to Create a New Branch in Git
January 9, 2024

This article outlines the basic commands needed to create a Git branch. A Git branch allows you to work on...
Read more
How to Install CentOS 7
May 1, 2019

CentOS 7 is an open-source Linux distribution based on Red Hat Enterprise Linux (RHEL). CentOS is seen by many...
Read more
How to Set Up Local Yum Repositories on CentOS 7
April 29, 2019

In Linux, a repository is a central database of software. Most modern Linux distributions have a central...
Read more