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

Posted by 梁远鹏 on 2018-09-22 | 阅读 |,阅读约 1 分钟

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' ([email protected]: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 '[email protected]: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 '[email protected]: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 协议即可。

微信公众号

扫描下面的二维码关注我们的微信公众号,第一时间查看最新内容。同时也可以关注我的Github,看看我都在了解什么技术,在页面底部可以找到我的Github。

wechat-qrcode