建站不啰嗦,上手跟我做(二十四)Git 环境配置

源码下载

官方下载地址

编译配置

解压

[root@localhost local]# tar -zxvf git-2.23.0

编译

[root@localhost local]# cd git-2.23.0/
[root@localhost git-2.23.0]# make configure
GIT_VERSION = 2.23.0
   GEN configure
[root@localhost git-2.23.0]# ./configure --prefix=/usr/local/git
[root@localhost git-2.23.0]# make profix=/usr/local/git

安装

[root@localhost git-2.23.0]# make install

配置全局路径

[root@localhost git-2.23.0]# vim /etc/profile
export GITPATH=/usr/local/git-2.23.0
export PATH=$GITPATH/bin:$PATH
[root@localhost git-2.23.0]# source /etc/profile

查看 git 版本

[root@localhost git-2.23.0]# git version
git version 2.23.0

特殊问题处理

autoconf 命令未找到
[root@localhost git-2.23.0]# make configure
   GEN configure
/bin/sh: autoconf: command not found
make: *** [configure] Error 127
[root@localhost git-2.23.0]# yum install autoconf
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base                                                                                                                                                 | 3.6 kB  00:00:00  
[root@localhost git-2.23.0]# make configure
   GEN configure

cc 命令未找到
root@localhost git-2.23.0]# make install
   CC fuzz-commit-graph.o
/bin/sh: cc: command not found
make: *** [fuzz-commit-graph.o] Error 127

[root@localhost git-2.23.0]# yum -y install gcc gcc-c++ libstdc++-devel 
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
[root@localhost git-2.23.0]# make install
   CC fuzz-commit-graph.o
In file included from commit-graph.h:4:0,
                from fuzz-commit-graph.c:1:
git-compat-util.h:297: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@localhost git-2.23.0]# yum install openssl-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
[root@localhost git-2.23.0]# make install
   CC fuzz-commit-graph.o
   CC fuzz-pack-headers.o
curl.h 未找到
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@localhost git-2.23.0]# yum install libcurl-dev libcurl-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
expat.h 未找到
[root@localhost git-2.23.0]# make install
   CC http.o
   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@localhost git-2.23.0]# yum install expat-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
[root@localhost git-2.23.0]# make install
   CC http-push.o
   LINK git-http-push
   CC credential-cache.o
   LINK git-credential-cache
   CC credential-cache--daemon.o

上一篇 建站不啰嗦,上手跟我做(二十三)Go 环境配置
目录