根据Wassim的答案以及有关tls-
自签名和自定义CA签名证书的gitlab文档,如果您不是gitlab服务器的管理员,而是运行者(以及运行者)的管理员,则可以节省一些时间以root身份运行):
SERVER=gitlab.example.comPORT=443CERTIFICATE=/etc/gitlab-runner/certs/${SERVER}.crt# Create the certificates hierarchy expected by gitlabsudo mkdir -p $(dirname "$CERTIFICATE")# Get the certificate in PEM format and store itopenssl s_client -connect ${SERVER}:${PORT} -showcerts </dev/null 2>/dev/null | sed -e '/-----BEGIN/,/-----END/!d' | sudo tee "$CERTIFICATE" >/dev/null# Register your runnergitlab-runner register --tls-ca-file="$CERTIFICATE" [your other options]更新1: 证书必须是正确位置的绝对路径。
更新2 :由于gitlab-runner错误#2675,使用自定义CA签名仍可能失败



