Skip to content

Instantly share code, notes, and snippets.

@mahamuniraviraj
Created May 10, 2017 19:56
Show Gist options
  • Save mahamuniraviraj/ac4807c43694ec4d8d360ebf12e93df1 to your computer and use it in GitHub Desktop.
Save mahamuniraviraj/ac4807c43694ec4d8d360ebf12e93df1 to your computer and use it in GitHub Desktop.
Install Latest Git On Cent OS 7
# Centos 7.3 comes with 1.8.3
# so update git from centos repo
yum update git
# it shows nothing to update
# we download git source and build and install latest git on Centos 7.3
# Go to https://github.com/git/git/releases to get latest git release
# download tar.gz file in /opt folder https://github.com/git/git/archive/vX.XX.XX.tar.gz XX is versio no
cd /opt
ll
# extract tar.gz
tar -zxf vX.XX.X.tar.gz
cd vX.XX.X
# install development tools
yum groupinstall 'Development Tools'
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker
# confirm we are in git source directory
pwd
# Compile git from sources
make prefix=/usr/local/git all
# install git
make prefix=/usr/local/git install
# Check version
git --version
# still shows version 1.8
set path to new version
# create script file to set path
vi /etc/profile.d/setGitPath.sh
# press insert and type following commands
#!/bin/sh
# set git path to latest installed git version 2.13.0 (/usr/local/git/bin/git)
# instead of preinstalled git version 1.8.3 (/bin/git)
export PATH=/usr/local/git/bin:$PATH
#press escape and type :wqa to save and exit
# apply changes
source /etc/profile.d/setGitPath.sh
# check version
git --version
@makoojogit
Copy link

Good instructions. Very helpful. Thanks.

@ribeiropaulor
Copy link

Very helpful for me too. Thanks!

@quangnd
Copy link

quangnd commented Apr 13, 2018

It works well. Thanks a lot!

@danielfsilva88
Copy link

danielfsilva88 commented Apr 20, 2018

Pretty good. To improve to newbie people like me, it could had some command below the download comment, like:

#download tar.gz file in /opt folder https://github.com/git/git/archive/vX.XX.XX.tar.gz XX is versio no
wget https://github.com/git/git/archive/vX.XX.XX.tar.gz
or
curl -LJO https://github.com/git/git/archive/vX.XX.XX.tar.gz

But anyway, thanks!

@ceballos59
Copy link

ceballos59 commented May 3, 2018

two thumbs up

@ericg108
Copy link

works. thanks a lot

@AzerMammadli
Copy link

Thank you so so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment