Git是一个开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大项目。Git是Linus Torvalds为帮助管理Linux内核开发而开发的一个开放源码的版本控制软件。Git与常用的版本控制工具CVS、Subversion等不同,它采用分布式版本库的方式,不必服务器端软件支持。

0x1 Centos7系统yum 安装以后的git版本过低

1
2
[root@localhost ~]# git --version
git version 1.8.3.1

0x2 安装开发套件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
sudo yum groupinstall "Development Tools"
[root@git git-2.21.0]# sudo yum groupinstall "Development Tools"
Loaded plugins: fastestmirror
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.tuna.tsinghua.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package autoconf.noarch 0:2.69-11.el7 will be installed
--> Processing Dependency: m4 >= 1.4.14 for package: autoconf-2.69-11.el7.noarch
--> Processing Dependency: perl(Data::Dumper) for package: autoconf-2.69-11.el7.noarch
---> Package automake.noarch 0:1.13.4-3.el7 will be installed
--> Processing Dependency: perl(Thread::Queue) for package: automake-1.13.4-3.el7.noarch
--> Processing Dependency: perl(TAP::Parser) for package: automake-1.13.4-3.el7.noarch
---> Package bison.x86_64 0:3.0.4-2.el7 will be installed
---> Package byacc.x86_64 0:1.9.20130304-3.el7 will be installed
---> Package cscope.x86_64 0:15.8-10.el7 will be installed
--> Processing Dependency: emacs-filesystem for package: cscope-15.8-10.el7.x86_64
---> Package ctags.x86_64 0:5.8-13.el7 will be installed
---> Package diffstat.x86_64 0:1.57-4.el7 will be installed
---> Package doxygen.x86_64 1:1.8.5-3.el7 will be installed
---> Package elfutils.x86_64 0:0.176-2.el7 will be installed
---> Package flex.x86_64 0:2.5.37-6.el7 will be installed
---> Package gcc.x86_64 0:4.8.5-39.el7 will be installed
--> Processing Dependency: cpp = 4.8.5-39.el7 for package: gcc-4.8.5-39.el7.x86_64

我们服务器如果安装区块链或Jenkins等软件容易因为版本低造成问题
若git版本太低,则卸载重装

1
2
3
4
5
6
7
8
9
10
11
12
yum remove git
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.21.0.tar.gz
tar -xvzf git-2.21.0.tar.gz
cd git-2.21.0
make prefix=/usr/local/git all
make prefix=/usr/local/git install
执行上面两端命令时可能会出现缺少依赖的情况,依次百度寻找缺少的依赖并安装
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
source /etc/bashrc
git --version
[root@git home]# git --version
git version 2.21.0

0x3 排错流程

问题1

1
2
3
4
5
6
7
8
9
[root@git git-2.21.0]# make prefix=/usr/local/git all
CC fuzz-commit-graph.o
In file included from commit-graph.h:4:0,
from fuzz-commit-graph.c:1:
git-compat-util.h:287:25: fatal error: openssl/ssl.h: No such file or directory
#include <openssl/ssl.h>
^
compilation terminated.
make: *** [fuzz-commit-graph.o] Error 1

处理过程

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
[root@git git-2.21.0]# yum install -y curl-devel expat-devel gettext-devel openssl-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.tuna.tsinghua.edu.cn
Package gettext-devel-0.19.8.1-2.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package expat-devel.x86_64 0:2.1.0-10.el7_3 will be installed
---> Package libcurl-devel.x86_64 0:7.29.0-54.el7_7.1 will be installed
base/7/x86_64/filelists_db | 7.3 MB 00:00:00
updates/7/x86_64/filelists_db | 3.5 MB 00:00:00
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================
Installing:
expat-devel x86_64 2.1.0-10.el7_3 base 57 k
libcurl-devel x86_64 7.29.0-54.el7_7.1 updates 303 k

Transaction Summary
===========================================================================================================================
Install 2 Packages

Total download size: 359 k
Installed size: 802 k
Is this ok [y/d/N]: y
Downloading packages:
(1/2): expat-devel-2.1.0-10.el7_3.x86_64.rpm | 57 kB 00:00:00
(2/2): libcurl-devel-7.29.0-54.el7_7.1.x86_64.rpm | 303 kB 00:00:00
---------------------------------------------------------------------------------------------------------------------------
Total 1.6 MB/s | 359 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libcurl-devel-7.29.0-54.el7_7.1.x86_64 1/2
Installing : expat-devel-2.1.0-10.el7_3.x86_64 2/2
Verifying : expat-devel-2.1.0-10.el7_3.x86_64 1/2
Verifying : libcurl-devel-7.29.0-54.el7_7.1.x86_64 2/2

Installed:
expat-devel.x86_64 0:2.1.0-10.el7_3 libcurl-devel.x86_64 0:7.29.0-54.el7_7.1

Complete!

评论