git 源码安装

用习惯了windows下高版本2.11.0的git,再到centos7自带的1.8.5版本觉得操作还是不方便,所以今天就把它升级到最新版。

必须安装的dependencies

# yum install gcc perl openssl-devel libcurl-devel expat-devel perl-ExtUtils-MakeMaker

这里不同环境具体也是不同的,缺什么就安装什么。上面只是我在阿里云服务器上安装时缺少的工具和头文件。 可选安装的dependencies,安装文档套件时所需要的,安装说明文档有写到:

$ make prefix=/usr all doc info ;# as yourself
# make prefix=/usr install install-doc install-html install-info ;# as root

To build and install documentation suite, you need to have the asciidoc/xmlto toolchain. Because not many people are inclined to install the tools, the default build target (“make all”) does not build them.

"make doc” builds documentation in man and html formats; there are also “make man”, “make html” and “make info”. Note that “make html” requires asciidoc, but not xmlto. “make man” (and thus make doc) requires both.

"make install-doc” installs documentation in man format only; there are also “make install-man”, “make install-html” and “make install-info”.

即安装 man 手册,需要 asciidoc 和 xmlto,用以下命令

# yum install asciidoc.noarch xmlto

接下来就是安装了,我一般都是查网络文档,所以没有安装任何man、info、html文档,下面是安装man文档的命令

# make prefix=/usr install install-doc

如果不需要man,就不用安装 asciidoc.noarch、xmlto 了。

官方的git 安装说明
另外,可参考另一篇写得更详细的文章Git服务器安装详解及安装遇到问题解决方案