How to Install Git on CentOS 7?

Git is a famous version-control system that tracks your code and code management changes. Thousands of web programers use Git to achieve speed and data integrity for their projects. 

If you find that the default Git version installed on your CentOS may be outdated, we can install Git's latest version.

We will move forward with the assumption that you are logged in with root or sudo user. 

Following are the steps to install Git on CentOS – 

1. Create a new file named wandisco-git.repo inside the /etc/yum.repos.d/ path using the command given below – 

# sudo vi /etc/yum.repos.d/wandisco-git.repo

2. Add the following lines in wandisco-git.repo – 


name=Wandisco GIT Repository





3. We will import the Repository GPG Key using the below-given command – 

#sudo rpm --import


4. Now, we will run the command given below to install the latest version of Git – 

#sudo yum install git

5. Verify the Git version using this command – 

#git --version        

It should give output with the latest version of Git.

git version 2.22.0

7. Once Git is installed, we will add personal information using git-config.

git config --global user.the name "Your Name"

git config --global "[email protected]"

8. Execute the command given below for the verification of your details.

git config --global "[email protected]"     

You have successfully installed and configured the latest version of Git on CentOS 7.

Was this answer helpful?

« Back