How To Install Git on Centos 7

In this guide, we want to teach you How To Install and Configure the Latest Stable Git on Centos 7.

Git is a DevOps tool used for source code management. It is a free and open-source version control system used to handle small to very large projects efficiently. Git is used to track changes in the source code, enabling multiple developers to work together on non-linear development.

Steps To Install and Configure Git on Centos 7

To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with Centos 7.

Install Git From source on Centos 7

Git packages are available in the default Centos repository. But in this guide, we will install Git in the latest version from the source.

First, update your local package index with the command below:

sudo yum update -y

Then, use the following command to install the required packages and dependencies:

sudo yum install gettext-devel curl-devel expat-devel openssl-devel perl-CPAN perl-devel zlib-devel unzip cmake gcc make wget -y

Download Git

Now you need to visit the Git Release page and find the master zip archive or the latest stable release from Git.

Next, use the wget command to download the Latest git on Centos 7:

sudo wget

When your download is completed, unzip your file with the command below:

sudo unzip

Switch to your Git directory:

cd git-2.39.0

Install Git

At this point, use the following commands to install Git:

# sudo make prefix=/usr/local all
# sudo make prefix=/usr/local install

When you are done, verify your Git installation on Centos 7 by checking its version:

git --version
git version 2.39.0

Configure Git on Centos 7

At this point, you must configure Git so that the generated commit messages you make will contain the correct information and support you as you build your software project.

You must provide your name and email address because Git embeds this information into each commit you do. To do this, you can use the following commands:

# git config --global "Your Name"
# git config --global "[email protected]"

After setting up the user name and email ID, you can verify the details using git config --list command:

git config --list
Output Name[email protected]

All the configuration done through the git command will save the information in a file called .gitconfig in the user’s home directory. So you can also verify the configuration by checking this file using cat ~/.gitconfig command as shown below:

cat ~/.gitconfig
name=Your Name
   email=[email protected]

Testing Git

Now that you have set up Git on Centos 7, you can try using it by performing git clone operations from GitHub.

We can just clone a repository called wig by using git clone command as shown below. This will create a directory wig in your local system and copy all the contents from the repository:

git clone
Cloning into 'wig'...
remote: Enumerating objects: 4240, done.
remote: Total 4240 (delta 0), reused 0 (delta 0), pack-reused 4240
Receiving objects: 100% (4240/4240), 4.47 MiB | 11.45 MiB/s, done.
Resolving deltas: 100% (2832/2832), done.

Also, you can check all the subcommands available with the git command using git help -a command as shown below:

git help -a


At this point, you have learned to Install and Configure Latest Stable Git on Centos 7.

Hope you enjoy it.

You may be like these articles on the Orcacore website:

How To Install PHP 8.2 on Centos 7

How to Install and Use Docker on Centos 7

Install and Configure Varnish Cache For Apache on Centos 7

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!