How to Install Git on a CentOS 6.4 VPS

Introduction

 

Git is a distributed revision control and source code management system released in 2005 and distributed under GNU General Public License v.2. Git handles large amounts of data and possesses tracking capabilities which are non-dependent on network access or central server.

This tutorial will cover the installation of Git on CentOS 6.4 using the package manager yum.

 

Installation of Git using Yum

 

In most of the Linux distributions, git is readily available from CentOS’s default repositories. You will be able to install the latest version with the command:

sudo yum install git

 

You may have to confirm the installation by typing ‘y’ for yes.

 

Installation of Git from Source

 

In case if you want the latest version of Git to be installed from source, here is how:

Before starting the installation, you will need the compilation tools for CentOS:

 

sudo yum groupinstall "Development Tools"

 

This will install the tools and compilers required for transforming source code into binary executables.

Now, you need to download the required dependencies using the command:

sudo yum install zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto openssl-devel

 

After that, you can get the latest version of git from github.com:

cd ~
wget -O git.zip https://github.com/git/git/archive/master.zip

 

Unzip it and switch into that directory:

unzip git.zip cd git-master

 

Now, you will be able to configure the package, build executables and install it with following commands:

make configure
 ./configure --prefix=/usr/local 
make all doc 
sudo make install install-doc install-html

 

You can update the Git in future using:

git clone git://github.com/git/git

 

Git Set Up

 

Once Git is installed, you need to copy your username and email in the git config file for tracking changes.

Open the config file and add the following lines of code to it:

nano ~/.gitconfig

 

git config --global user.name "Your Name Here"
git config --global user.email "[email protected]"

Verify the settings using the command:

git config --list

 

user.name=Your Name Here
[email protected]

 

In case if you omit the step of updating your username and email, Git may throw a message similar to any of these outputs depending on the version of Git installed:

[master 0d9d21d] initial project version
 Committer: root 

Your name and email address were configured automatically basedon your username and hostname. Please check that they are accurate.You can suppress this message by setting them explicitly:
     git config --global user.name "Your Name"
    git config --global user.email [email protected]

 After doing this, you may fix the identity used for this commit with:
     git commit --amend --reset-author

OR

git commit

*** Please tell me who you are.
 Run

   git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

 to set your account's default identity.
Omit --global to set the identity only in this repository.
 fatal: empty ident name (for ) not allowed

 

support2 has written 111 articles

Leave a Reply