How to Install Git on CentOS 7

Updated on

3 min read

Install Git on CentOS

This tutorial will walk you through the installation and basic configuration of Git on CentOS 7.

Git is the most popular version control system that’s being used by hundreds of thousands of projects. Git allows you to keep track of your code changes, revert to previous stages, work simultaneously on multiple branches, and collaborate with your fellow developers.

Git is originally developed by Linus Torvalds , the creator of the Linux kernel.

At the time of writing this article, the current version of Git available in the default CentOS 7 repositories is 1.8.3, which is pretty outdated.

The easiest way to install the most recent version of Git (v2.18) is to install it using the yum package management tool from the Wandisco repositories.

Another option is to compile Git from the source which allows you to install the latest Git release and customize the build options. However, you won’t be able to update your Git installation through the yum package manager.


Before continuing with this tutorial, make sure you are logged in as root or a user with sudo privileges .

Installing Git on CentOS 7

Follow these steps to install the latest Git version on your CentOS 7 system:

  1. The first step is to enable the Wandisco GIT repository. To do that, open your text editor and create a new YUM repository configuration file named wandisco-git.repo in the /etc/yum.repos.d/ directory:

    sudo nano /etc/yum.repos.d/wandisco-git.repo
    name=Wandisco GIT Repository

    Import the repository GPG keys with:

    sudo rpm --import
  2. Once the repository is added, install the latest version of Git by running the following command:

    sudo yum install git
  3. To verify the installation type the command below which will print the Git version:

    git --version

    The output will look something like below, meaning that Git version 2.18.0 has been successfully installed on your CentOS system.

    git version 2.18.0
  4. Now that you have Git installed it is a good idea to set up your personal information that will be used when you commit changes to your code.

    To set your git commit username and email address type:

    git config --global "Your Name"git config --global ""

    Use the following command to verify the changes:

    git config --list Name

    The configuration settings are stored in the ~/.gitconfig file:

        name = Your Name
        email =

    To make further changes to your Git configuration, you can either use the git config command or edit the ~/.gitconfig file by hand.


We have shown you how to install Git on your CentOS 7 machine. You should now visit the online version of the Pro Git book and learn more about how to use Git.

If you hit a problem or have feedback, leave a comment below.