How to Install Git on CentOS 8

Install Git on CentOS 8

In this article, we will have explained the necessary steps to install and configure Git on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Git is a distributed version control system, which you can use to track the code changes (versions) while developing software. Git offers features such as reverting to a previous stage, multiple workflows, local branching, and many others. This makes Git one of the best version control systems and that is why it is used by many software developers.

Install Git on CentOS

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo yum install epel-release
sudo yum update

Step 2. Install Git on CentOS 8.

Run the following command to install Git:

sudo yum install git

To verify that Git is successfully installed you can use the following command:

$ git --version
git version 2.18.1

Step 3. Configuring Git.

The following commands will set your commit name and email address:

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

To confirm that you have set your information correctly in Git, type:

$ git config --list
user.name=intanramona
[email protected]

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

~/.gitconfig
[user]
    name = intanramona
    email = [email protected]

Congratulation, you have learned how to install and configure Git on CentOS 8. If you have any questions, please leave a comment below.