How to Install Git Client 12.9.2 Version on CentOS 7.6

Installation of Git Client 12.9.2 On CentOS 7.6

Required Dependencies:

curl-devel expat-devel gettext-devel gcc openssl-devel zlib-devel perl-ExtUtils-MakeMaker

Latest Git version download link

enter link description here

Installation Procedure:

Install the dependencies that are required to install the latest version of git client

[root@linuxhelp ~]#  yum install curl-devel expat-devel gettext-devel gcc openssl-devel zlib-devel perl-ExtUtils-MakeMaker -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.xeonbd.com
 * extras: mirror.ehost.vn
 * updates: mirror.nbrc.ac.in
base                                                                                                                                                                                        | 3.6 kB  00:00:00     
Package perl-ExtUtils-MakeMaker-6.68-3.el7.noarch already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package expat-devel.x86_64 0:2.1.0-10.el7_3 will be installed
---> Package gcc.x86_64 0:4.8.5-36.el7_6.2 will be installed
--> Processing Dependency: libgomp = 4.8.5-36.el7_6.2 for package: gcc-4.8.5-36.el7_6.2.x86_64
--> Processing Dependency: cpp = 4.8.5-36.el7_6.2 for package: gcc-4.8.5-36.el7_6.2.x86_64
--> Processing Dependency: libgcc >= 4.8.5-36.el7_6.2 for package: gcc-4.8.5-36.el7_6.2.x86_64
---> Package gettext-devel.x86_64 0:0.19.8.1-2.el7 will be installed
--> Processing Dependency: gettext-common-devel = 0.19.8.1-2.el7 for package: gettext-devel-0.19.8.1-2.el7.x86_64
--> Processing Dependency: git for package: gettext-devel-0.19.8.1-2.el7.x86_64
---> Package libcurl-devel.x86_64 0:7.29.0-51.el7 will be installed
updates/7/x86_64/filelists_db                                                                                                                                                               | 4.6 MB  00:00:00     
---> Package openssl-devel.x86_64 1:1.0.2k-16.el7_6.1 will be installed
.
.
.
.
.
.
Installed:
  expat-devel.x86_64 0:2.1.0-10.el7_3      gcc.x86_64 0:4.8.5-36.el7_6.2      gettext-devel.x86_64 0:0.19.8.1-2.el7      libcurl-devel.x86_64 0:7.29.0-51.el7      openssl-devel.x86_64 1:1.0.2k-16.el7_6.1     
  zlib-devel.x86_64 0:1.2.7-18.el7        

Dependency Installed:
  cpp.x86_64 0:4.8.5-36.el7_6.2             gettext-common-devel.noarch 0:0.19.8.1-2.el7   git.x86_64 0:1.8.3.1-20.el7            keyutils-libs-devel.x86_64 0:1.5.8-3.el7   krb5-devel.x86_64 0:1.15.1-37.el7_6  
  libcom_err-devel.x86_64 0:1.42.9-13.el7   libselinux-devel.x86_64 0:2.5-14.1.el7         libsepol-devel.x86_64 0:2.5-10.el7      libverto-devel.x86_64 0:0.2.5-4.el7        pcre-devel.x86_64 0:8.32-17.el7      
  perl-Error.noarch 1:0.17020-2.el7         perl-Git.noarch 0:1.8.3.1-20.el7               perl-TermReadKey.x86_64 0:2.30-20.el7  

Dependency Updated:
  libgcc.x86_64 0:4.8.5-36.el7_6.2                  libgomp.x86_64 0:4.8.5-36.el7_6.2                  openssl.x86_64 1:1.0.2k-16.el7_6.1                  openssl-libs.x86_64 1:1.0.2k-16.el7_6.1                 

Complete!

Locate the git by using the following command

[root@linuxhelp ~]# which git
/usr/bin/git

Remove git file from the above mentioned path.

[root@linuxhelp ~]# rm -rf /usr/bin/git

Change the directory to /usr/src

[root@linuxhelp ~]# cd /usr/src

Download the latest version of Git client using the below mentioned link

[root@linuxhelp src]# wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.19.2.tar.gz
--2019-07-15 08:28:14--  https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.19.2.tar.gz
Resolving mirrors.edge.kernel.org (mirrors.edge.kernel.org)... 147.75.101.1, 2604:1380:2001:3900::1
Connecting to mirrors.edge.kernel.org (mirrors.edge.kernel.org)|147.75.101.1|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7720555 (7.4M) [application/x-gzip]
Saving to: ‘git-2.19.2.tar.gz’

100%[====================================================================================================>] 7,720,555    186KB/s   in 61s    

2019-07-15 08:29:17 (124 KB/s) - ‘git-2.19.2.tar.gz’ saved [7720555/7720555]

After the successful download,extract the tar file of git by executing the following command.

[root@linuxhelp src]# tar xzf git-2.19.2.tar.gz

Change the directory to extracted directory git

[root@linuxhelp src]# cd git-2.19.2/

Build the git software in the following location

 [root@linuxhelp git-2.19.2]# make prefix=/usr/local/git all
GIT_VERSION = 2.19.2
    * new build flags
    CC credential-store.o
    * new link flags
    CC common-main.o
    CC abspath.o
    CC advice.o
    CC alias.o
    CC alloc.o
    CC apply.o
    CC archive.o
.
..
.
.
.
.
.
GEN bin-wrappers/test-line-buffer
    GEN bin-wrappers/test-parse-options
    GEN bin-wrappers/test-pkt-line
    GEN bin-wrappers/test-svn-fe
    GEN bin-wrappers/test-tool
    GEN git-remote-testgit

Install the git software under the /usr/local location

[root@linuxhelp git-2.19.2]# make prefix=/usr/local/git install
    SUBDIR git-gui
    SUBDIR gitk-git
    SUBDIR templates
install -d -m 755 '/usr/local/git/bin'
install -d -m 755 '/usr/local/git/libexec/git-core'
install   git-credential-store git-daemon git-fast-import git-http-backend git-imap-send git-sh-i18n--envsubst git-shell git-remote-testsvn git-http-fetch git-http-push git-credential-cache git-credential-cache--daemon git-remote-http git-remote-https git-remote-ftp git-remote-ftps git-bisect git-difftool--helper git-filter-branch git-merge-octopus git-merge-one-file git-merge-resolve git-mergetool git-quiltimport git-rebase git-request-pull git-stash git-submodule git-web--browse git-add--interactive git-archimport git-cvsexportcommit git-cvsimport git-cvsserver git-send-email git-svn git-p4 git-instaweb '/usr/local/git/libexec/git-core'
install -m 644  git-mergetool--lib git-parse-remote git-rebase--am git-rebase--interactive git-rebase--preserve-merges git-rebase--merge git-sh-setup git-sh-i18n '/usr/local/git/libexec/git-core'
install git git-upload-pack git-receive-pack git-upload-archive git-shell git-cvsserver '/usr/local/git/bin'
make -C templates DESTDIR='' install
make[1]: Entering directory `/usr/src/git-2.19.2/templates'
install -d -m 755 '/usr/local/git/share/git-core/templates'
(cd blt && tar cf - .) | \
(cd '/usr/local/git/share/git-core/templates' && umask 022 && tar xof -)
.
.
..
.
.
.
done && \
./check_bindir "z$bindir" "z$execdir" "$bindir/git-add"

Setup the environment variable for Git as follows

[root@linuxhelp git-2.19.2]# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc

Reload the bashrc file to update the changes

[root@linuxhelp git-2.19.2]# source /etc/bashrc

Verify the version of git as follows

[root@linuxhelp git-2.19.2]# git --version
git version 2.19.2

With this,Installation of Git Client 12.9.2 version on CentOS 7.6 comes to end.

Tag : Git CentOS
FAQ
Q
What is Git repository In Git?
A
Git repository in Git is just a file location where it stores all the files related to the project.
Q
What is the difference between Git And GitHub?
A
Git is a tool where you can manage your source code ,GitHUb is a hosting service for Git repositories.
Q
Can Git be used to tract the changes in any set of files?
A
Yes,Git can be used to track the changes in any set of files.
Q
Wher does Git stores the information?
A
Git stores the information in a data structure called repository.
Q
What is the purpose of git?
A
The purpose of git client is to manage a project,set of files as they change over time