Install Git from Source Code

Step by step to install git from source code.

1. Prerequisite

1.1 CentOS

1
2
3
yum install zlib-devel
yum install asciidoc
yum install xmlto

1.2 Debian

1
2
3
apt-get install zlib1g-dev
apt-get install asciidoc
apt-get install xmlto

2. Install

You can get it via the kernel.org site, at https://www.kernel.org/pub/software/scm/git, or the mirror on the GitHub website, at https://github.com/git/git/tags.

1
2
3
4
5
6
7
wget https://github.com/git/git/archive/refs/tags/v2.40.1.tar.gz
tar -zxf v2.40.1.tar.gz
cd v2.40.1
make configure
./configure --prefix=/usr
make all doc info
sudo make install install-doc install-html install-info

3. Reference

使用 Hugo 构建
主题 StackJimmy 设计