How to install Git on CentOS 8

How to install Git on CentOS 8

Install Git on CentOS 8

Git is currently the most popular version control system. Helps share and collaborate on software development projects. Mainly used for source code control. In this tutorial, you will learn how to install Git on CentOS 8.

Prerequisites

Before you start installing Git on CentOS 8, you need a non-root user account with sudo privileges on the server or desktop.

1. Install Git on CentOS

To install the latest Git on CentOS, you need to enable GIT repository on CentOS. First, create a new file inside /etc/yum.repos.d/ Directory using the following command: Next, copy the line below the command.

sudo nano /etc/yum.repos.d/wandisco-git.repo

Copy the following line in the file created above.

[wandisco-git]
name=Wandisco GIT Repository
baseurl=http://opensource.wandisco.com/centos/7/git/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco

Then type CTRL + X and then “Y” to save your edits and exit.

Next, enter the following command to import the GPG key of the added repository key.

sudo rpm --import http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco

Enter the following command to install Git.

sudo yum install git

Check the installation and run the following command to check the version

git --version

The output looks like this:

git version 2.18.0

2. Git setup

Must be fully configured with Git information to prevent warnings every time

First set the Git global username

git config --global user.name "User Name"

Next, set up Git Global Email

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

You can edit the .gitconfig file to change the above configuration. To edit gitconfig file type

nano ~/.gitconfig

Edit the above file with your name and email.

Conclusion

Here, you learned how to install Git on CitOS 8, and also learned how to set up Git to start working on your system. If you have any questions about this, don’t forget to comment below.

Sidebar