How to Install Git on CentOS 8

Version Control System tool plays a vital role in today’s modern Software development. Version control is a software that helps a group of software developers work together and manage the history of the work. It does not overwrite other’s changes, therefore you can keep track of every change, revert the file or a project to its previous state.

The version control tool helps you to recover the lost file very easily. If a mistake is made by anyone from the team, one can look back and compare the earlier version of the file and fix the mistake or any conflict.

Git is one of the most popular decentralized version control tools used by developers to coordinate the work amongst them. It was designed by Linus Torvalds ( the creator of Linux Kernel.) in the year 2005.

Git offers features like data assurance, workflows, create branches, revert to the previous stage, incredible speed, keep track of your code changes, view logs, and many more. It allows you to perform your work in offline mode and when ready, you need the internet connection to publish the changes and take the latest changes.

In this tutorial, we will explain to you how to install Git on a CentOS 8 server using yum and source code. Each installation has its own benefits, the choice is up to you.

For example, users who want to Perpetuate Git update will use the yum method and those who need features by a particular version of Git will use the source code method.

Important: You must have a CentOS 8 server installed and configured with a sudo user with root privileges. If you don’t have one, you can create a sudo account

Installing Git with Yum on CentOS 8

One of the simplest and easiest ways to install Git is with a yum package manager, but the available version may be older than the newest version available. If you want to install the newest release of Git, consider compiling it from source (instructions for compiling Git from the source given further down below).

$ sudo yum install git

Once installed git, you can verify the version of installed Git using the following command.

$ git --version

git version 2.18.1

Installing Git from Source Code

If you want to feature by a specific version of Git or need flexibility in installation then one of the best methods is to gather the software Git from Source. However, it will not manage and update Git installation through the yum package manager but will allow you to install the latest version of Git and customize the build options. This method is a bit lengthy process.

Before we move forward with the installation, you will need the following necessary tools to build the binary from the source.

$ sudo yum groupinstall "Development Tools"
$ sudo yum install wget unzip gettext-devel openssl-devel perl-CPAN perl-devel zlib-devel libcurl-devel expat-devel

Once the tools are installed successfully, open any browser and visit Gits project’s mirror on GitHub Release. The one at the top is the latest version of Git, but it may vary at your end. Now, look at the version you require then right-click the source code (tar.gz) and copy the link to download using following wget command as shown.

$ sudo wget -O git.tar.gz

Once the download is completed unzip the source package using tar command, now move into the directory.

$ sudo tar -xf git.tar.gz
$ cd git-*

Now install and build Git from source using the following command.

$ sudo make prefix=/usr/local all install

Once compilation finishes, you can type the following command to verify the Git Version installation.

$ git --version

git version 2.23.0

Configuring Git

Now git is installed on the CentOS machine successfully, now you will need to set up your personal info which will be used when you commit any changes to your code.

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

To verify that the above settings were added successfully, you can list all of the configuration settings that have been added by typing.

$ git config --list Name
[email protected]

The above settings are stored in the global configuration ~/.gitconfig file. To make any additional changes to this file, use git config command or edit the file manually.


That’s It! In this article, we have explained how to install Git on CentOS 8 server using yum and source code. To learn more about Git, read our article on How to Use Git Version Control System in Linux [Comprehensive Guide]

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

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