Centos7 gitlab-ci shell使用git pull拉取代码出错原因

  • 在自动化shell中执行了:git pull, 出现如下错误:
Running with gitlab-runner 12.7.1 (003fe500)
  on api deploy xLVW27yp
Using Shell executor...
Running on VM_222_128_centos...
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /root/builds/xLVW27yp/0/wggweb-api/wggapi/.git/
fatal: git fetch-pack: expected shallow list
fatal: The remote end hung up unexpectedly
ERROR: Job failed: exit status 1

  • 在github的issues中找到了问题,是由于centos的git版本默认为1.8,版本过低导致的错误,将git升级到2.x版本即可解决。

  • yum remove git*删除原来的git。

  • yum -y install https://centos7.iuscommunity.org/ius-release.rpm添加源。

  • yum -y install git2u-all安装2.x版本git。

发布了60 篇原创文章 · 获赞 0 · 访问量 1426

猜你喜欢

转载自blog.csdn.net/ClassmateLin/article/details/104339475