安装
依赖安装
[[email protected] ~]# yum -y install gcc openssl-devel expat-devel libcurl-devel
下载源码包
[[email protected] ~]# wget https://github.com/git/git/archive/refs/tags/v2.31.7.tar.gz
[[email protected] ~]# tar zxf v2.31.7.tar.gz
[[email protected] ~]# cd git-2.31.7/
编译安装
[[email protected] git-2.31.7]# make all
[[email protected] git-2.31.7]# make install
验证
[[email protected] git-2.31.7]# git --version
git version 2.31.7
遇到的错误
缺少openssl/ssl.h
[[email protected] git-2.31.7]# make all
make: curl-config: Command not found
CC fuzz-commit-graph.o
In file included from commit-graph.h:4:0,
from fuzz-commit-graph.c:1:
git-compat-util.h:303:25: fatal error: openssl/ssl.h: No such file or directory
#include
^
compilation terminated.
make: *** [fuzz-commit-graph.o] Error 1
解决办法
[[email protected] git-2.31.7]# yum -y install openssl-devel
缺少curl依赖
In file included from http.c:2:0:
http.h:6:23: fatal error: curl/curl.h: No such file or directory
#include
^
compilation terminated.
make: *** [http.o] Error 1
解决办法
[[email protected] git-2.31.7]# yum -y install libcurl-devel
缺少expat依赖
CC http-walker.o
CC http-fetch.o
LINK git-http-fetch
CC http-push.o
http-push.c:22:19: fatal error: expat.h: No such file or directory
#include
^
compilation terminated.
make: *** [http-push.o] Error 1
解决办法
[[email protected] git-2.31.7]# yum -y install expat-devel
文章来源于互联网:Centos7下源码编译安装git命令