Installing latest Git in CentOS 6.7

Hello ,

I am Raja. Today I am writing this article on installing latest Git in CentOS 6.7 via source.

Actually in CentOS 6.7 , we are getting only 1.7.1 version but the latest Git version is git-2.6.3. And while installing I've been through lot of R&D.
Here I am providing you everything in a single article.

Here the avalibale version of git in CentOS 6.7.

[localserver@dhcppc2 ~]$ yum list  git
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.vonline.vn
* extras: mirrors.vonline.vn
* updates: mirrors.vonline.vn
Available Packages
git.i686 1.7.1-3.el6_4.1 base
[localserver@dhcppc2 ~]$

Lets begin with install

1. Create a directory and change into that directory.
mkdir git
cd git

2. Get git downloaded using wget and unrar it
wget https://www.kernel.org/pub/software/scm/git/git-2.6.3.tar.gz
tar -xvf git-2.6.3.tar.gz


and then change into directory
cd git-2.6.3

3.Actually in Linux , source based installation are can done with 3 easy steps and they are

./configure
make
make install ( as root user in the same directory )

When I have started  "./configure" I came to know that gcc has not installed in my CentOS 6.7. so installing it with

 
yum install gcc


Then continued to configure and again I got stucked with


cache.h:21:18: warning: zlib.h: No such file or directory
Can't locate ExtUtils/MakeMaker.pm
/bin/sh: msgfmt: command not found


errors. so to stop all these errors I am giving all libraries in single line

yum install zlib zlib-devel perl-ExtUtils-MakeMaker gettext  gcc -y 

Then run these commands again

./confgure
make
make install (as root)
that's it. Git installation got completed.

Now execute below steps to configure your Git and make sure you have a Git account with same E-mail.

git config --global user.name "Raja Sekhar Reddy G"
git config
--global user.email ""

----------------------------------------------------------------------

Till now all we have done installation and configuring of Git . Now lets make a SSH based communication between your localrepo's to your Git account.

1. Generate SSH key with your E-mail of Github account

ssh-keygen -t rsa -b 4096 -C ""


2. Make sure SSH-Agent running , it will help us here with key based authentication.

eval "$(ssh-agent -s)"


from the above command if PID got returned then that means SSH-Agent running

and then execute below command

ssh-add ~/.ssh/id_rsa


3. Now open your Public key with below command and copy it.

cat ~/.ssh/id_rsa.pub

4. Login to your Github account.
Github home page -> Settings -> SSH Keys -> Add SSH Keys

It will open a Input field,  paste your copied key and submit.

5. Come to your terminal and type this

ssh -T git@github.com


You will get similar message like below

Hi rajagennu! You've successfully authenticated, but GitHub does not provide shell access.


Now lets create a localrepo and sync it with Github repo remotely

In your terminal , type as

mkdir Python_Admin
cd Python_Admin/
echo "# Python_Admin" >> README.md
cat README.md
git init
git add README.md
git commit -m "First Commit"
git remote add origin git@github.com:rajagennu/Python_Admin.git
git push -u origin master


Now look at your Github repo. You will see your files there.
For example , you have created file named as : sysload.py

then , lets add to git and push to remote repo

touch sysload.py             # created sysload.py
git add sysload.py # added into Git repo
git commit -m "just added local file" # committing changes to localrepo"
git push -u origin master


Now look at your remoterepo in GitHub. You can find sysload.py file there.

Hope it will helps you.

If you need any help , dont hesitate to ask.

Thank you.










0 Comments