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]

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Anusha Saive
Anusha worked for many years in the IT industry as a Project Manager, and also a senior writer and editor at Tecmint. She is a huge fan of Linux and is passionate about writing Linux and technology-related stuff.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.