Gitlab Pipeline failing "remote: HTTP Basic: Access denied"
Asked Answered
N

2

6

I'm new to Gitlab Pipelines and want to set up one for one of my Python projects. I'm using the docker GitLab-runner container with this Configuration file:

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

Whenever a pipeline is executed I get this error message:

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

The Gitlab Runner is assigned to a project. I already tried to reset everything and use it with my IP address, my DNS address, my local IP, my local device name but nothing worked yet

I read about others having the same problems, mostly in 2016 or older. Is there anything I'm missing? Is there a setting I have to set correctly?

EDIT: Thanks, @Vadim for correcting my tags

After some more testing, I tried the same with a public repository. And to my surprise, it worked. The Problem is the Authorisation. I still need to add as much as possible to my configuration, test if it affects the public repo, and then try it with a private repo. I will keep this more updated as I heard of others having the same problems

Newhall answered 25/5, 2022 at 17:4 Comment(2)
Try solutions from #47861272Thule
I tested all of them but had no successNewhall
T
17

For my case, gitlab was behind a proxy other than the built-in traefik proxy. I believe this caused the necessity of using this setting. After registering your runner, edit the config.toml and and add the clone_URL

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

This solved the issue for me.

Terpene answered 15/7, 2022 at 15:23 Comment(4)
I already tried this one. But for others, it might be a good solution. I will add my progress nowNewhall
Thanks a lot, the "clone_url" line saved me. I suggest restarting the docker if you're concerned: docker restart gitlab-runnerBunion
This one worked for me too. I'm not clear why, but for now I'm just taking it. Thanks for the solution!Diego
clone_url fixes this problem when running GitLab on-premise behind a reverse proxyShaker
A
0

One thing that might help you is to try and pass the actual IP in the extra hosts for the runner.

It should go into the config.toml for the runner something like extra_hosts = [ 192.1xx.x.x:mygitlab.de]

Aphotic answered 27/5, 2022 at 18:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.