How to Install Git on CentOS 7

Install Git on CentOS 7

In this article, we will have explained the necessary steps to install and configure Git on CentOS 7. 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.

Step 2. Install Git on CentOS 7.

First, enable the Wandisco GIT repository:

Import the repository GPG keys:

Now install Git by typing following command:

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

Step 3. Setting Up Git.

Now that you have Git installed it is a good idea to set up your personal information that will be used when you commit changes to your code:

You can also change above configuration by editing .gitconfig file. To edit gitconfig file type:

To verify that you entered the correct information you can use the command below:

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