Git is a free and open source, fast and distributed version control system (VCS), which by design is based on speed, efficient performance and data integrity to support small-scale to extensive software development projects.
Git is a software repository that allows you to keep a track of your software changes, revert to previous version and create another version of files and directories.
Git is written in C, with a mix of Perl and a variety of shell scripts, its primarily intended to run on the Linux kernel and has a number of remarkable features as listed below:
In this how-to guide, we shall move through the necessary steps of installing Git on CentOS/RHEL 7/6 and Fedora 20-24 Linux distributions along with how to configure Git so that you can start participating right away..
Open /launch your centos machine
a. Click on not listed?
Type root in the Text box bellow to UserName
a. Then press enter button or click on next button
here you have to enter the root user password .
a. After giving the root user password .. please wait for some time
Now your machine is ready to work.
Now click on mouse right button
Then select open terminal ( listed in bottom in the menu)
Now you are in terminal
[root@testserver ~]# git --version
bash: git: command not found...
Note: if you are using CentOS 7 or higher version..! 1.8 Version will come by default, No problems with that leave it continue with fallowing steps. Finally we can remove the older version.
[root@testserver ~]#
Before you begin, first you need to install required software dependencies from the default repositories, along with the utilities that needed to build a binary from source:
[root@testserver ~]# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel y
[root@testserver ~]# yum install gcc perl-ExtUtils-MakeMaker y
If not installed already..! Install now by fallowing above command
[root@testserver ~]# cd /usr/src
[root@testserver src]# ls l
total 0
drwxr-xr-x. 2 root root 6 Apr 11 2018 debug
drwxr-xr-x. 4 root root 71 Jun 12 20:40 kernels
[root@testserver src]#
After you have installed required software dependencies, go to the official Git release page and grab the latest version and compile it from source using following series of command:
For download git open source software, open the bellow website
http://clouddevops.in/git_releases.html
or
click on bellow link from our site. https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.27.0.tar.gz or
you can download from git official website
or
click on bellow link from our site.
https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.27.0.tar.gz
[root@testserver src]# pwd
/usr/src
[root@testserver src]#
[root@testserver src]# wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.27.0.tar.gz
[root@testserver src]# ll
total 9172
drwxr-xr-x. 2 root root 6 Apr 11 2018 debug
-rw-r--r--. 1 root root 9391548 Jun 1 22:03 git-2.27.0.tar.gzv
[root@testserver src]#
[root@testserver src]# ll
total 9172
drwxr-xr-x. 2 root root 6 Apr 11 2018 debug
-rw-r--r--. 1 root root 9391548 Jun 1 22:03 git-2.27.0.tar.gz
drwxr-xr-x. 4 root root 71 Jun 12 20:40 kernels
[root@testserver src]#
[root@testserver src]#
[root@testserver src]#
Extract the tar package by fallowing bellow command
[root@testserver src]# tar -xvf git-2.27.0.tar.gz
git-2.27.0/
git-2.27.0/.cirrus.yml
git-2.27.0/.clang-format
git-2.27.0/.editorconfig
git-2.27.0/.gitattributes
git-2.27.0/.github/
git-2.27.0/.github/CONTRIBUTING.md
git-2.27.0/.github/PULL_REQUEST_TEMPLATE.md
git-2.27.0/.github/workflows/
git-2.27.0/.github/workflows/main.yml
git-2.27.0/.gitignore
git-2.27.0/.gitmodules
git-2.27.0/.mailmap
git-2.27.0/.travis.yml
git-2.27.0/.tsan-suppressions
git-2.27.0/CODE_OF_CONDUCT.md
git-2.27.0/COPYING
git-2.27.0/Documentation/
git-2.27.0/Documentation/.gitattributes.
.
.
.
git-2.27.0/xdiff/xinclude.h
git-2.27.0/xdiff/xmacros.h
git-2.27.0/xdiff/xmerge.c
git-2.27.0/xdiff/xpatience.c
git-2.27.0/xdiff/xprepare.c
git-2.27.0/xdiff/xprepare.h
git-2.27.0/xdiff/xtypes.h
git-2.27.0/xdiff/xutils.c
git-2.27.0/xdiff/xutils.h
git-2.27.0/zlib.c
git-2.27.0/configure
git-2.27.0/version
git-2.27.0/git-gui/version
[root@testserver src]#
[root@testserver src]# ll
total 9192
drwxr-xr-x. 2 root root 6 Apr 11 2018 debug
drwxrwxr-x. 27 root root 16384 Jun 1 21:19 git-2.27.0
-rw-r--r--. 1 root root 9391548 Jun 1 22:03 git-2.27.0.tar.gz
drwxr-xr-x. 4 root root 71 Jun 12 20:40 kernels
[root@testserver src]#
[root@testserver src]#
[root@testserver src]# ll
total 9192
drwxr-xr-x. 2 root root 6 Apr 11 2018 debug
drwxrwxr-x. 27 root root 16384 Jun 1 21:19 git-2.27.0
-rw-r--r--. 1 root root 9391548 Jun 1 22:03 git-2.27.0.tar.gz
drwxr-xr-x. 4 root root 71 Jun 12 20:40 kernels
Enter into the git-2.27.0 folder
[root@testserver src]# cd git-2.27.0/
You can check present working directory by applying pwd command.
[root@testserver ~]# pwd
/usr/src/git-2.27.0
[root@testserver ~]#
Compile the source files
[root@testserver ~]# make prefix=/usr/local/git all
[root@testserver ~]# make prefix=/usr/local/git all
GIT_VERSION = 2.27.0
* new build flags
CC fuzz-commit-graph.o
CC fuzz-pack-headers.o
CC fuzz-pack-idx.o
CC bugreport.o
* new link flags
CC common-main.o
CC abspath.o
CC add-interactive.o
CC add-patch.o
CC advice.o
CC alias.o
CC alloc.o
CC apply.o
CC archive-tar.o
CC archive-zip.o
CC archive.o
CC argv-array.o
* new prefix flags
CC attr.o
CC base85.o
CC bisect.o
CC blame.o
CC blob.o
CC bloom.o
CC branch.o
CC bulk-checkin.o
CC bundle.o
CC cache-tree.o
CC chdir-notify.o
CC checkout.o
CC color.o
CC ewah/ewah_rlw.o
CC exec-cmd.o
CC fetch-negotiator.o
.
CC t/helper/test-xml-encode.o
LINK t/helper/test-tool
GEN bin-wrappers/git
GEN bin-wrappers/git-receive-pack GEN bin-wrappers/git-shell
GEN bin-wrappers/git-upload-archive
GEN bin-wrappers/git-upload-pack
GEN bin-wrappers/git-cvsserver
GEN bin-wrappers/test-fake-ssh
GEN bin-wrappers/test-line-buffer
GEN bin-wrappers/test-svn-fe
GEN bin-wrappers/test-tool
[root@testserver ~]#
Install the git software now by fallowing bellow command.
[root@testserver ~]# make prefix=/usr/local/git install
[root@testserver ~]# 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-bugreport git-credential-store git-daemon git-fast-import git-http-backend git-
imap-send git-remote-testsvn git-sh-i18n--envsubst git-shell 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-request-pull 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--preserve-merges git-sh-i18n
git-sh-setup '/usr/local/git/libexec/git-core'
install git git-receive-pack git-shell git-upload-archive git-upload-pack git-cvsserver '/usr/local/git/bin'
make -C templates DESTDIR='' install
make[1]: Entering directory `/usr/src/git-2.27.0/templates'
install -d -m 755 '/usr/local/git/share/git-core/templates'
ln -s "git-remote-http" "$execdir/$p" || \
{ test -z "" && \
ln "$execdir/git-remote-http" "$execdir/$p" 2>/dev/null || \
ln -s "git-remote-http" "$execdir/$p" 2>/dev/null || \
cp "$execdir/git-remote-http" "$execdir/$p" || exit; } \
done && \
./check_bindir "z$bindir" "z$execdir" "$bindir/git-add"
[root@testserver ~]#
[root@testserver ~]#
Setting the git path
[root@testserver ~]# vim ~/.bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
export PATH=$PATH:/usr/local/git/bin
~
~
~
:wq
[root@testserver ~]# source ~/.bashrc
bashrc or source ~/. bashrc will preserve your current shell: Except for the modifications that reloading ~/. bashrc into the current shell (sourcing) makes, the current shell and its state are preserved, which includes environment variables, shell variables, shell options, shell functions, and command history.
[root@testserver ~]# source ~/.bashrc
[root@testserver ~]# git --version
git version 1.8.3.1
[root@testserver ~]#
[root@testserver ~]#
[root@testserver ~]#
Remove the older version by fallowing bellow command.
[root@testserver ~]# yum remove git y
[root@testserver ~]# yum remove git -y
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.8.3.1-23.el7_8 will be erased
--> Processing Dependency: git = 1.8.3.1-23.el7_8 for package: perl-Git-1.8.3.1-23.el7_8.noarch
--> Processing Dependency: git for package: gettext-devel-0.19.8.1-3.el7.x86_64
--> Running transaction check
---> Package gettext-devel.x86_64 0:0.19.8.1-3.el7 will be erased
---> Package perl-Git.noarch 0:1.8.3.1-23.el7_8 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================
Package Arch Version Repository Size
==========================================================================================================
Removing:
git x86_64 1.8.3.1-23.el7_8 @updates 22 M
Removing for dependencies:
gettext-devel x86_64 0.19.8.1-3.el7 @base 1.4 M
perl-Git noarch 1.8.3.1-23.el7_8 @updates 57 k
Transaction Summary
===========================================================================================================
Remove 1 Package (+2 Dependent packages)
Installed size: 24 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : gettext-devel-0.19.8.1-3.el7.x86_64 1/3
Erasing : perl-Git-1.8.3.1-23.el7_8.noarch 2/3
Erasing : git-1.8.3.1-23.el7_8.x86_64 3/3
Verifying : git-1.8.3.1-23.el7_8.x86_64 1/3
Verifying : perl-Git-1.8.3.1-23.el7_8.noarch 2/3
Verifying : gettext-devel-0.19.8.1-3.el7.x86_64 3/3
Removed:
git.x86_64 0:1.8.3.1-23.el7_8
Dependency Removed:
gettext-devel.x86_64 0:0.19.8.1-3.el7
perl-Git.noarch 0:1.8.3.1-23.el7_8
Complete!
[root@testserver ~]#
[root@testserver ~]# hash r
hash r command used to Forget all remembered locations, and determine them right now. If you run a command and bash can't find it (because you made a change to your system, for example), run hash -r and try the command again.
root@testserver git-2.27.0]# hash -r
[root@testserver ~]#
[root@testserver ~]#
[root@testserver ~]# git --version
git version 2.27.0
[root@testserver ~]#
[root@testserver ~]# git --version
git version 2.27.0
[root@testserver ~]#
The DevOps seminar will help you to learn DevOps from scracth to deep knowledge of various DevOps tools such as fallowing List.