{"id":11782,"date":"2022-01-27T09:29:30","date_gmt":"2022-01-27T14:29:30","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=11782"},"modified":"2022-01-27T09:29:33","modified_gmt":"2022-01-27T14:29:33","slug":"how-to-install-git-on-centos-7-linux-system","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/how-to-install-git-on-centos-7-linux-system\/","title":{"rendered":"How To Install Git on CentOS 7 With Examples"},"content":{"rendered":"\n
In the developer world, source control<\/a> is important in that it allows the development teams to track and manage changes to code by keeping the history and helps resolve conflicts when merging contributions from multiple sources. Before we see how to install Git on CentOS 7 we need to know what Git is.<\/p>\n\n\n\n Git<\/a> is a free and open-source distributed version control system. It is software designed for tracking changes in sets of files and directories. It aims to achieve speed, data integrity, and support for distributed, and non-linear workflows.<\/p>\n\n\n\n Git happens to be one of the most popular and active version control systems. Sites like GitHub, GitLab, and Bitbucket have made sharing and contributing to code with Git much easier and more widespread than ever.<\/p>\n\n\n\n You will need a fully configured and working CentOS 7<\/a> server with a non-root user with sudo privileges. You should have basic knowledge of using the Linux terminal.<\/p>\n\n\n\n Git is available in the CentOS software repositories so that is where we will install it from. This is the fastest method even though the downside of this method is that the Git version that is installed may be older than the newest version available. If you need the latest release, you can install Git from the source.<\/p>\n\n\n\n Let’s proceed. To install Git on CentOS 7 from the default software repositories we will be using yum, CentOS’s native package manager. We start by updating the package list and upgrading the Linux<\/a> system:<\/p>\n\n\n\n Now we install Git.<\/p>\n\n\n\n You can double-check the installation by checking the Git version using this:<\/p>\n\n\n\n With Git installed, you need to configure it in ready for your first and subsequent uses. Here you will be configuring some information about yourself so that commit messages will be created with the correct information attached.<\/p>\n\n\n\n This is done by providing the name and email address that you would like to have embedded into your commits using the git config command:<\/p>\n\n\n\n Confirm your configurations.<\/p>\n\n\n\nPrerequisites<\/h2>\n\n\n\n
Step 1: Install Git on CentOS 7<\/h2>\n\n\n\n
$ sudo yum update && sudo yum upgrade<\/code><\/pre>\n\n\n\n
$ sudo yum install git<\/code><\/pre>\n\n\n\n
$ git --version<\/code><\/pre>\n\n\n\n
Step 2: Setting Up Git<\/h2>\n\n\n\n
$ git config --global user.name "Example User"\n$ git config --global user.email "git.user@example.com"<\/code><\/pre>\n\n\n\n
$ git config --list<\/code><\/pre>\n\n\n\n
Output\nuser.name=Example User\nuser.email=git.user@example.com<\/code><\/pre>\n\n\n\n
Install the Latest Git From Source Code<\/h2>\n\n\n\n
Step 1: Download Git Source<\/h2>\n\n\n\n