Git

How to Install Git on CentOS 8

Git is known as a very popular version control system for the modern era’s software development. It helps track changes, reverting to previous stages, and branching to create a different software version. This post will help you and provide a to-the-point procedure on how to install and configure Git on CentOS 8 operating system.

Installation of Git on CentOS 8

The latest and stable version of Git is available in the official DNF package repository of the CentOS 8 Operating system, and we can download and install Git from there.

We just have first to upgrade the DNF package repository cache using the command given below:

$ sudo dnf makecache

Upgrade already installed packages as well using the command:

$ sudo dnf upgrade -y

When the system’s upgradation is completed, execute the Git’s installation command typed below:

$ sudo dnf install git -y

The ‘-y’ flag will answer yes to the prompt that occurred by the system and confirm the installation.

The Git is completely installed on the CentOS 8 operating system, and the installation can be verified using the command provided below:

$ git --version

You can witness in the screenshot attached that version 2.8.2 of Git is successfully installed on the CentOS 8 operating system. Now let’s see how to set up the basic configuration of Git for getting started with it.

How to Setup basic Configuration of Git on CentOS 8

After completing the installation phase of Git on CentOS 8, let’s perform some basic configuration of Git to get a fresh start.

First, we should configure the username and email address so that the commit messages will have the right information. We can configure both username and email address using the git config command as shown in the commands given below:

$ git config --global user.name "user_name"
$ git config --global user.email "[email protected]"

This information will be stored in the ‘.gitconfig’ configuration file of the Git, and if you want to take a look again or edit that information, you can use the command provided below:

$ sudo nano ~/.gitconfig

After viewing the detail or changing it as per our desire, save the file and exit using the keyboard shortcut keys CTRL + S and CTRL + X.

Conclusion

This is how you can install, configure, and get started with Git on the CentOS 8 Operating system. You have learned a simple and straightforward method to install Git on CentOS 8 from its Official DNF package repository and configure the user name and email address for the commit messages.

About the author

Shehroz Azam

A Javascript Developer & Linux enthusiast with 4 years of industrial experience and proven know-how to combine creative and usability viewpoints resulting in world-class web applications. I have experience working with Vue, React & Node.js & currently working on article writing and video creation.