第六章 安装最新版 Git 客户端

该文章根据 CC-BY-4.0 协议发表,转载请遵循该协议。
本文地址:https://fenying.net/book/minicentos-handbook/06.compile-git/

本章编译安装 Git 客户端的 2.11.0 版本。

0. 安装依赖

1yum install expat expat-devel curl libcurl-devel python perl -y
2yum remove git -y
3
4cd /mnt/temp
5
6wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
7
8tar -xzvf libiconv-1.14.tar.gz
9cd libiconv-1.14

先修改 ./srclib/stdio.in.h 文件,把其中一行

1_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");

注释掉。然后开始编译

1./configure
2make -j 4 && make install
3cd ..
4rm -rf libiconv-1.14

1. 开始编译

 1ln -s /usr/local/lib/libiconv.so.2 /usr/lib
 2ln -s /usr/local/lib/libiconv.so /usr/lib
 3
 4tar -zxvf git-2.11.0.tar.gz
 5cd git-2.11.0
 6make configure
 7./configure \
 8    --prefix=/usr/local/git \
 9    --with-iconv=/usr/local/lib \
10    --with-curl \
11    --with-openssl \
12    --with-libpcre \
13    --with-editor=vi \
14    --with-pager=less
15make -j4
16make install
17ln -s /usr/local/git/bin/git /usr/bin

2. 检查安装

1git --version
comments powered by Disqus