51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

Centos7下源码编译安装git命令

安装

依赖安装

[root@cloud-master ~]# yum -y install gcc openssl-devel expat-devel libcurl-devel

下载源码包

官方最新git源码地址

[root@cloud-master ~]# wget https://github.com/git/git/archive/refs/tags/v2.31.7.tar.gz
[root@cloud-master ~]# tar zxf v2.31.7.tar.gz 
[root@cloud-master ~]# cd git-2.31.7/

编译安装

[root@cloud-master git-2.31.7]# make all
[root@cloud-master git-2.31.7]# make install

验证

[root@cloud-master git-2.31.7]# git --version
git version 2.31.7

遇到的错误

缺少openssl/ssl.h

[root@cloud-master 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 <openssl/ssl.h>
                         ^
compilation terminated.
make: *** [fuzz-commit-graph.o] Error 1

解决办法

[root@cloud-master 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 <curl/curl.h>
                       ^
compilation terminated.
make: *** [http.o] Error 1

解决办法

[root@cloud-master 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 <expat.h>
                   ^
compilation terminated.
make: *** [http-push.o] Error 1

解决办法

[root@cloud-master git-2.31.7]# yum -y install expat-devel
赞(0)
未经允许不得转载:工具盒子 » Centos7下源码编译安装git命令