GitLab Runner注册报错:first path segment in URL cannot contain colon求助
GitLab Runner注册报错「error: first path segment in URL cannot contain colon」解决方案
报错原因
该错误是注册Runner时填写的GitLab实例URL格式违规,URL首个路径段包含冒号——通常是把端口号错误放在路径部分,或是URL整体格式不符合规范导致。
详细解决步骤
修正GitLab URL格式
正确的URL格式示例:- 标准HTTPS地址:
https://gitlab.example.com - 带自定义端口的地址:
https://gitlab.example.com:8443(冒号必须放在域名与端口之间,不能出现在路径开头)
错误示例(会触发报错):https://gitlab.example.com/:8443(首个路径段:8443包含冒号)
- 标准HTTPS地址:
重新执行注册流程
删除错误的配置文件(默认路径为/etc/gitlab-runner/config.toml),重新运行注册命令:gitlab-runner register按提示输入信息时,严格核对GitLab URL,确保格式正确,例如:
输入GitLab实例URL:https://你的GitLab域名.com 或 https://你的GitLab域名.com:端口号
手动修改配置文件
若已完成注册,直接编辑config.toml文件,修正url字段格式:[[runners]] name = "你的Runner名称" url = "https://gitlab.example.com" token = "你的Runner令牌" executor = "shell"修改后重启GitLab Runner服务:
sudo gitlab-runner restart
验证结果
执行以下命令检查Runner状态,返回Verified successfully即为问题解决:
gitlab-runner verify
内容的提问来源于stack exchange,提问作者Harshit vidhyarthi
相关产品推荐
相关产品推荐

