You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

自建GitLab Pipeline CI任务报403错误及Runner连接问题

GitLab CI Pipeline 403错误及Runner连接异常问题

环境配置

  • Ubuntu VPS上部署Docker版GitLab-ce容器,通过Nginx反向代理实现HTTPS访问,域名为git.domain.com
  • 已部署GitLab Runner容器并关联至测试项目

测试项目CI配置

项目仅包含README.md和.gitlab-ci.yml文件,CI配置如下:

image: docker:latest

before_script:  
  - echo "Hello, yoo"
  - echo "Hello, yoo"

stages:
    - build
    - test
build:
    stage: build
    script:
        - echo "building.....!"
    artifacts:
        paths:
            - build/
test:
    stage: test
    script:
        - echo "Testing....!"

报错详情

触发CI Pipeline时,build步骤执行失败,错误日志如下:

Running with gitlab-runner 15.8.0 (12335144)   on test-docker-runner
7PpT2V-e, system ID: r_tGxvS4HIDNWl Preparing the "docker" executor
00:04 Using Docker executor with image docker:latest ... Pulling
docker image docker:latest ... Using docker image
sha256:cd27a71ea4555b89fda3a6fd0118200e247b9f05cd07d3c16c58e67bee7c290d
for docker:latest with digest
docker@sha256:3cf33ff6e893a39262bd9f6b85ff46e068fa2a98d201326e9c3058a22a21a6bb
... Preparing environment 00:00 Running on
runner-7ppt2v-e-project-2-concurrent-0 via 468dc8b24685... Getting
source from Git repository 00:02 Fetching changes with git depth set
to 20... Reinitialized existing Git repository in
/builds/gitlab-instance-91dbc115/test/.git/ fatal: unable to access
'http://3fd88525ccde/gitlab-instance-91dbc115/test.git/': The
requested URL returned error: 403 Cleaning up project directory and
file based variables 00:01 ERROR: Job failed: exit code 1

已执行的排查操作

  • 为测试项目添加管理员权限成员
  • 将项目可见性设置为内部
  • 本地克隆测试:使用容器ID3fd88525ccde的HTTP URL无法解析主机,替换为域名https://git.domain.com/...可正常克隆

后续更新及新问题

修改docker-compose配置,为GitLab服务添加hostname="git.domain.com"后,Runner拉取代码的URL问题得到解决,但出现新问题:Runner无法连接GitLab,重新注册时提示连接拒绝。


内容的提问来源于stack exchange,提问作者Rouzbeh Zarandi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 20:09:23