Skip to content

Instantly share code, notes, and snippets.

@MHMDhub
Created December 19, 2019 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MHMDhub/d2d1a857fc5af5b18d6fff70fb4489b5 to your computer and use it in GitHub Desktop.
Save MHMDhub/d2d1a857fc5af5b18d6fff70fb4489b5 to your computer and use it in GitHub Desktop.
====================================================================
HOW TO INSTALL FROM CODE/INSTALLING GIT FROM SOURCE:
====================================================================
Step 1 – Prerequsities:
----------------------
$ yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
$ yum install gcc perl-ExtUtils-MakeMake
Step 2 – Install Git on CentOS:
-----------------------------
Download latest Git source code from kernel git or simply use following command to download Git 2.21.0.
Then, compile and install:
cd /usr/src
wget https://www.kernel.org/pub/software/scm/git/git-2.21.0.tar.gz
$ tar xzf git-2.21.0.tar.gz
After downloading and extracting Git source code, Use the following command to compile the source code.
$ cd git-2.21.0
$ make prefix=/usr/local/git all
$ make prefix=/usr/local/git install
(Another way is creating doing
$ make configure
$ ./configure --prefix=/us
)
$ make all doc info
$ sudo make install install-doc install-html install-info
Step 3 – Setup Environment:
---------------------------
After installation of git client. Now you just need to set binary in the system environment. Set the PATH variable with newly installed git binary in /etc/bashrc by executing below command. Also, reload the changes in the current environment.
echo "export PATH=/usr/local/git/bin:$PATH" >> /etc/bashrc
source /etc/bashrc
After completing the steps. Let’s use the following command to check the current git version.
git --version
git version 2.21.0
After this is done, you can also get Git via Git itself for updates:
$ git clone git://git.kernel.org/pub/scm/git/git.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment