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

GitLab流水线连接rpi.local的443端口失败问题求助

解决GitLab流水线HTTP转HTTPS导致的连接拒绝问题

问题场景

树莓派4部署GitLab,VirtualBox Ubuntu虚拟机配置GitLab Runner,流水线执行时GitLab的HTTP地址http://rpi.local被自动转为HTTPS,导致连接443端口被拒绝,流水线失败。

流水线执行日志

Fetching changes with git depth set to 20...
Initialized empty Git repository in /builds/root/testing/.git/
Created fresh repository.
fatal: unable to access 'https://rpi.local/root/testing.git/': Failed to connect to rpi.local port 443 after 11 ms: Connection refused
ERROR: Job failed: exit code 1

GitLab配置

已在/etc/gitlab/gitlab.rb中设置地址为http://rpi.local

Runner的config.toml配置

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "vlab"
  url = "http://rpi.local"
  token = "..."
  executor = "docker"
  dns_search = ["rpi.local"]
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]
  [runners.docker]
    tls_verify = false
    image = "alpine:latest"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache/"]
    shm_size = 0

流水线配置

stages:
  - build

build-job:
   stage: build
   tags:
     - ubuntu
   script:
     - echo "Compiling the code..."
     - echo "Compile complete."

解决方案

1. 检查并修正GitLab的HTTPS重定向配置

编辑GitLab配置文件/etc/gitlab/gitlab.rb,确保以下配置正确:

# 明确设置HTTP地址
external_url 'http://rpi.local'
# 禁用HTTP转HTTPS的重定向
nginx['redirect_http_to_https'] = false

保存后执行配置重载和服务重启:

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart

2. 确认项目仓库的克隆URL设置

进入GitLab项目的设置 > 仓库页面,查看「克隆URL」区域,确保HTTP地址为http://rpi.local/root/testing.git。如果显示为HTTPS地址,手动切换为HTTP并确认保存。

3. 在流水线中强制使用HTTP仓库地址

在流水线配置中添加before_script,手动覆盖仓库的remote地址为HTTP:

stages:
  - build

build-job:
   stage: build
   tags:
     - ubuntu
   before_script:
     - git remote set-url origin http://rpi.local/root/testing.git
   script:
     - echo "Compiling the code..."
     - echo "Compile complete."

4. 配置GitLab Runner禁用HTTPS验证(可选)

如果上述方法无效,可在Runner的config.toml中添加环境变量,强制Git忽略SSL验证:
在[[runners]]下的[runners.docker]块中添加:

environment = ["GIT_SSL_NO_VERIFY=true"]

修改后重启GitLab Runner服务:

sudo gitlab-runner restart

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.23 01:54:21