A version control system is a piece of software that records changes to a file or set of files over time so that you can recall specific versions of these files at a later date. The need for version control is not limited to developers in today’s complex and mission-critical infrastructure environments. System administrators too can make efficient use of version control to track changes in their scripts and/or place different configuration files under version control.
GIT is a powerful distributed version control system, perhaps the most powerful and feature-rich version control system available as of this writing.

We’ve already briefly talked about the need for version control for system administrators and in this article, we will talk about how GIT came into existence and how to install it on a centos system.


History of GIT
GIT was created by Linus Torvalds in 2005. It is written in Perl and C. The GIT project was essentially started as a substitute version control system for the Linux Kernel after BitKeeper withdrew its support. This project has since become immensely popular among since the emergence of the devops movement and framework and continues to increase its popularity.


GIT Design goals:

  • Speed
  • Simplicity
  • Strong branch/merge support
  • Distributed
  • Scales well for large projects

We mentioned in our introduction that GIT is a distributed version control system. Given below are the advantages of distributed version control systems over other types:

  • Developers generally push changes to their own repository which are then pulled into the official repository by the project maintainers.
  • Cloning of repositories serves as an easy way to backup projects as each clone is a full backup.
  • Allows branches and applying fixes to different branches.
  • A full local history is available along with other repository statistics.
  • Deployment is very streamlined.
Related concept:   5 Steps to merge a GIT branch

Install GIT

GIT runs on Linux, OS X, Windows, and many other operating systems.

Now we will show you how to install GIT via yum. For RedHat and Centos systems, the git package along with its dependencies is available in the base repository. To install git via yum we execute the following command:

[[email protected] ~]# yum install git -y
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
epel/x86_64/metalink | 8.2 kB 00:00:00
extras | 3.4 kB 00:00:00
puppetlabs-pc1 | 2.5 kB 00:00:00
updates | 3.4 kB 00:00:00
Loading mirror speeds from cached hostfile
* base:
* epel:
* extras:
* updates:
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0: will be updated
--> Processing Dependency: git = for package: perl-Git-
---> Package git.x86_64 0: will be an update
--> Running transaction check
---> Package perl-Git.noarch 0: will be updated
---> Package perl-Git.noarch 0: will be an update
--> Finished Dependency Resolution
Dependencies Resolved
Package Arch Version Repository Size
git x86_64 updates 4.4 M
Updating for dependencies:
perl-Git noarch updates 53 k
Transaction Summary
Upgrade 1 Package (+1 Dependent package)
Total download size: 4.4 M
Downloading packages:
updates/7/x86_64/prestodelta | 605 kB 00:00:02
Delta RPMs reduced 53 k of updates to 26 k (50% saved)
(1/2): perl-Git- | 26 kB 00:00:02
(2/2): git- | 4.4 MB 00:00:42
Total 105 kB/s | 4.4 MB 00:00:43
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : perl-Git- 1/4
Updating : git- 2/4
Cleanup : perl-Git- 3/4
Cleanup : git- 4/4
Verifying : git- 1/4
Verifying : perl-Git- 2/4
Verifying : perl-Git- 3/4
Verifying : git- 4/4
git.x86_64 0:
Dependency Updated:
perl-Git.noarch 0:
[[email protected] ~]#


Related concept:   GIT: How to set or change Username and E-mail?

Install GIT from source:
We’ll now show you how to install it from source. Before you begin, you’ll need to install the software that git depends on.  We’ll now install these dependencies with the following commands:

sudo yum groupinstall "Development Tools"
sudo yum install gettext-devel openssl-devel perl-CPAN perl-devel zlib-devel

The development tools package group consists of tools like gcc which are essential in compiling and building binaries from source code.

I’ve downloaded git using the git repository  on github.

[[email protected] ~]# ls -l
-rw-r--r--. 1 root root 8615986 Dec 30 03:51
[[email protected] ~]#

Let’s unzip it.

[[email protected] ~]# unzip

Now that the file has been extracted, let’s take a look inside the directory.

[[email protected] git-master]# pwd
[[email protected] git-master]# ls | wc -l

Once we are in the source folder, we can begin the source build process.  We can perform pre-build checks like software dependencies and hardware configurations with the configure script that is generated by make configure.
This script will also use a –prefix to declare /usr/local as the appropriate destination for the new binary and will create a Makefile to be used in the following step. We’ll generate the Makefile with the following commands:

make configure
./configure --prefix=/usr/local

Makefiles are scriptable configuration files that are processed by the make utility. Our Makefile will tell make how to compile a program and link it to our CentOS installation so that we can execute the program properly.  With a Makefile in place, we can now execute make install to compile the source code into a working program and install it on our server. We’ll now execute the make install command as follows to install the required packages on the system.

make install

Once the install completes, we can verify that we now have git installed by checking it’s version.

[[email protected] ~]# which git
[[email protected] ~]#
[[email protected] ~]# git --version
git version 2.16.0-rc0
[[email protected] ~]#


In this article, we showed you how to install git via the yum package manager and also from source. We also explained the need for version control systems and the different advantages they provide. In our next article, we’ll show how to configure git before we may start using it.

Related concept:   GIT initial configuration setup