gitlab-runner expected shallow list 问题处理

今天在使用 gitlab-runner 进行自动化部署的时候,出现了 expected shallow list 的报错,报错截图如下:

file

经过查询,是因为 runner 主机 git 版本过低导致。runner 主机系统版本为 CentOS 7,git 版本为 1.8.3.1,确实有点过低了。

由于 yum 仓库中 git 的版本不再更新,git 官方提供了几乎所有Linux 版本的二进制安装方式,但就是没有提供使用 yum 进行安装的方法,所以使用 yum 来更新 git,看似是不可能了。

难道只能用编译的方式来更新 git 了吗?对于我来说,不到万不得已还是不太想手动进行编译,没别的理由,就是因为懒。

在仔细查看官方文档后,在最底下看到了一段话(其实很明显):

Red Hat Enterprise Linux, Oracle Linux, CentOS, Scientific Linux, et al.
RHEL and derivatives typically ship older versions of git. You can download a tarball and build from source, or use a 3rd-party repository such as the IUS Community Project to obtain a more recent version of git.

意思是建议 RedHat 等 Linux 版本的玩家,使用源码进行编译,或者使用第三方仓库进行安装。并且还举了 IUS Community Project 这个例子。嗯……能被官方用来举例的,应该没什么大问题吧……

So,开干吧。

首先,当然是配置第三方仓库:

# RHEL/CentOS 7
yum install \
https://repo.ius.io/ius-release-el7.rpm \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

# Testing
yum install yum-utils
yum-config-manager --enable ius-testing

然后,就可以升级 git 了:

# 首先要将原来的卸载
sudo yum remove git -y;

# 安装新版本的 git
sudo yum install git236 -y;

需要注意的是,通过 IUS Community Project 来安装 git 的时候,并不是直接 install git,而是需要加上版本序号,比如 install git236 代表的就是安装 git-2.36.* 版本,如图:

file

最后,重新安装 gitlab-runner,问题圆满解决:

file

消息盒子

# 暂无消息 #

只显示最新10条未读和已读信息