How to install Git on Centos 7

How To Install Git, Version-Control System On Centos 7

Git is the most distributed popular version-control system for tracking changes in source code during software development and has been being used by hundreds of thousands of projects. Git was created by Linus Torvalds in 2005 for development of the Linux kernel with other kernel developers contributing to its initial development. With the benefit of a version control system, we can track, maintain and organize changes to source code, documents, and any kinds of collected information. Git allows us to keep track of our code changes, and if it was need, we can revert to previous stages. At this article we will discuss how to install the Git on Centos 7.

Git Installation

In this article we will show you how to install the Git on Centos 7 by using Wandisco GIT repository. There will be a prerequisite and several step for this purpose which will be as follow :

  • Prerequisite
  • Enabling and Import Wandisco GIT repository
  • Install Git with Yum command line
  • Verify Git Installation
  • Setup Personal Information

Prerequisite

The first step on installing Git is to ensure if we are having a user non root account with sudo privilige to install packages, internet connection and also the sufficient space.

Enabling and Import Wandisco GIT repository

Enabling Wandisco Git reposity can be done by creating a new YUM repository configuration file named wandisco-git.repo in the /etc/yum.repos.d/ directory by submitting command line below.

[ramans@localhost ~]$ sudo vi /etc/yum.repos.d/wandisco-git.repo

copy and paste the code below :

[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

and enable the wandisco repository by submiting command line below :

[ramans@localhost ~]$ sudo rpm --import http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
Adding wandisco repository
Adding wandisco repository

 

 

 

Install Git

When the repository has been added and enabled, than we can install Git by submitting command below.

[ramans@localhost ~]$ sudo yum install git
Git installation process
Git installation process

Verify Git Installation

When the Git installation was completed done, the next step is verifying it. The easy way for doing this can be queried Git version, with command below :

[ramans@localhost ~]$ git --version
 git version 2.22.0

The git latest version when the article is  being wriiten is version 2.22.0.

Setup Personal Information

Once the Git installation was completed done, it is s a good idea to set up our personal information that will be used when we commit changes to the code. It can be done by submitting the command below:

[ramans@localhost ~]$ git config --global user.name "Ramans"
[ramans@localhost ~]$ git config --global user.email "ramansah@otodiginet.com"
[ramans@localhost ~]$ git config --list
user.name=Ramans
user.email=ramansah@otodiginet.com
Git personal information setting
Git personal information

Conclusion

So far the git installation on Centos 7 was successful done.  Have a nice day at home.

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *