Gitlab管道失败“remote: HTTP Basic: Access denied”

6

我对Gitlab Pipelines比较陌生,想为我的Python项目设置一个Pipeline。我使用了docker GitLab-runner容器,并配备了以下配置文件:

version: '3'
services:
  runner:
    container_name: runner
    image: gitlab/gitlab-runner:latest
    restart: unless-stopped
    environment:
      - TZ=Europe/Berlin
    volumes:
      - ./data:/etc/gitlab-runner/
      - /var/run/docker.sock:/var/run/docker.sock

每当执行管道时,我都会收到以下错误消息:
Running with GitLab-runner 14.10.1 (f761588f)
  on docker xxxxxxx
Preparing the "docker" executor
Using Docker executor with image python:latest ...
Pulling docker image python:latest ...
Using docker image sha256:8dec8e39f2eca1ee1f1b668619023da929039a39983de4433d42d25a7b79267c for python:latest with digest python@sha256:567018293e51a89db96ce4c9679fdefc89b3d17a9fe9e94c0091b04ac5bb4e89 ...
Preparing environment
Running on runner-xxxxxxxxx-project-38-concurrent-0 via xxxxxxxx...
Getting source from Git repository
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in /builds/group/project/.git/
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'http://mygitlab.de/group/projekt.git/'
Cleaning up a project directory and file-based variables
ERROR: Job failed: exit code 1

Gitlab Runner被分配给一个项目。我已经尝试重置一切并使用我的IP地址、DNS地址、本地IP、本地设备名称,但仍然没有起作用。
我阅读了其他人在2016年或更早期遇到相同的问题。我是否漏掉了什么?是否有设置需要正确设置?
编辑: 感谢@Vadim纠正我的标签。
经过更多的测试,我尝试在公共存储库中进行相同的操作。令我惊讶的是,它起作用了。问题在于授权。我仍然需要尽可能多地添加到我的配置中,测试它是否影响公共存储库,然后尝试使用私人存储库。 如果听说其他人遇到同样的问题,我会保持更新。

尝试从https://dev59.com/e1YN5IYBdhLWcg3wK1fO中寻找解决方案。 - Amol Chintamani
我测试了所有的东西,但都没有成功。 - Dustin
2个回答

17

对于我的情况,GitLab 落后于内置的 Traefik 代理之外的代理。我相信这导致使用此设置的必要性。在注册您的 Runner 后,编辑 config.toml 并添加 clone_URL。

[[runners]]
  url = "https://gitlab.example.com"
  clone_url = "https://gitlab.example.com"

这对我解决了问题。


我已经尝试过这个了。但对于其他人来说,这可能是一个不错的解决方案。我现在会更新我的进展。 - Dustin
2
非常感谢,"clone_url" 那行救了我。如果您担心的话,我建议重新启动 Docker:docker restart gitlab-runner - djcaesar9114
这个对我也起作用了。我不清楚为什么,但现在我只是接受它。感谢解决方案! - chris.ribal
在使用反向代理运行GitLab的本地部署时,clone_url可以解决这个问题。 - sakisk

0

有一件事可能会对你有所帮助,那就是尝试在运行程序时将实际的 IP 地址传递到额外主机中。

它应该放在 runner 的 config.toml 文件中,类似于 extra_hosts = [ 192.1xx.x.x:mygitlab.de ]。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接