Skip to content

Instantly share code, notes, and snippets.

@tiqwab
Forked from egorsmkv/build-git.md
Created May 28, 2022 05:09
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 tiqwab/e3e06a44cd8666a22096075d82267d7b to your computer and use it in GitHub Desktop.
Save tiqwab/e3e06a44cd8666a22096075d82267d7b to your computer and use it in GitHub Desktop.
Build git from source code on CentOS 7

Build git from source code

1) Go to https://git-scm.com/ and check out the latest version of Git

Currently, the latest version is 2.18.0. Download and extract it and go to the folder of the source code:

wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.18.0.tar.gz
tar xf git-2.18.0.tar.gz
cd git-2.18.0/

2) Install the dependencies

yum groupinstall 'Development Tools'
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-CPAN perl-devel

3) Configure

make configure
./configure --prefix=/usr/local

4) Compile

make all

5) Install

make install
@tiqwab
Copy link
Author

tiqwab commented May 28, 2022

To uninstall

assume that configure with ./configure --prefix=/usr/local

# rm /usr/local/bin/git*
# rm -rf /usr/local/share/git-core
# find /usr/local/share/locale -type f -name 'git.mo' -exec sudo rm {} \;
# rm -rf /usr/local/share/perl5/Git /usr/local/share/perl5/FromCPAN /usr/local/share/perl5/Git.pm
# rm -rf /usr/local/share/gitweb
# rm -rf /usr/local/share/gitk
# rm -rf /usr/local/share/git-gui
# rm -rf /usr/local/libexec/git-core

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