CI过程中拉取仓库的注意点

Posted by lyp on Saturday, September 22, 2018

TOC

前言

CI过程中拉取仓库的注意点

备注:本文安装指南基于Ubuntu 16.04,在Centos上某些安装步骤的命令可能需要稍作改动。

CI Hugo博客时子模块注意点

在fork了hugo的主题仓库后,hugo使用了自己仓库的hugo主题,但是在CI过程中一直提示没有权限访问仓库。

Running with gitlab-runner 11.3.0-rc1 (861c565e)
  on docker-auto-scale 4e4528ca
Using Docker executor with image registry.gitlab.com/pages/hugo:latest ...
Pulling docker image registry.gitlab.com/pages/hugo:latest ...
Using docker image sha256:e49e435cc0445a3d9f8b2fe75c25fd226ed240940ed8c8c1c00aa339e4498144 for registry.gitlab.com/pages/hugo:latest ...
Running on runner-4e4528ca-project-8449745-concurrent-0 via runner-4e4528ca-srm-1537615348-42d15321...
Cloning repository...
Cloning into '/builds/liangyuanpeng/liangyuanpeng.gitlab.io'...
Checking out 643a5fbf as master...
Updating/initializing submodules recursively...
Submodule 'themes/hugo-theme-cleanwhite' (git@github.com:liangyuanpeng/hugo-theme-cleanwhite.git) registered for path 'themes/hugo-theme-cleanwhite'
Cloning into '/builds/liangyuanpeng/liangyuanpeng.gitlab.io/themes/hugo-theme-cleanwhite'...
fatal: cannot run ssh: No such file or directory
fatal: unable to fork
fatal: clone of 'git@github.com:liangyuanpeng/hugo-theme-cleanwhite.git' into submodule path '/builds/liangyuanpeng/liangyuanpeng.gitlab.io/themes/hugo-theme-cleanwhite' failed
Failed to clone 'themes/hugo-theme-cleanwhite'. Retry scheduled
Cloning into '/builds/liangyuanpeng/liangyuanpeng.gitlab.io/themes/hugo-theme-cleanwhite'...
fatal: cannot run ssh: No such file or directory
fatal: unable to fork
fatal: clone of 'git@github.com:liangyuanpeng/hugo-theme-cleanwhite.git' into submodule path '/builds/liangyuanpeng/liangyuanpeng.gitlab.io/themes/hugo-theme-cleanwhite' failed
Failed to clone 'themes/hugo-theme-cleanwhite' a second time, aborting
ERROR: Job failed: exit code 1

最后发现问题出在使用了git协议拉取仓库,导致没有权限访问。将协议改为https协议即可。