Why can't gitlab-runner clone my project? (Exec. shell, Incorrect hostname, failed to connect)

I am stuck with a problem and hope you can help me.

I set-up a Gitlab server and need to run tests Windows using gitlab-runner.exe.

When the test is spawned on a commit it fails with

Cloning into ‘C:/git/builds/ac70aeb9/0/test/myproject’…
fatal: unable to access ‘http://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@localhost/test/boundaries.git/’: Failed to connect to localhost port 80: Connection refused

The gitlab-runner’s executor is set to shell, the config.toml looks like

concurrent = 1
check_interval = 0

  name = "PC123"
  url = ""
  token = "cd2b093adc5ca09ea41ee4eadb0752"
  executor = "shell"

I suppose the problem is the hostname “localhost” in the URL, which should refers to the server, but points to the machine gitlab-runner is on. When I set-up the server in the beginning I used ‘localhost’ as the servers hostname. This was probably not the best idea. :slight_smile:

In the meantime I changed the servers hostname to “localgit”, but the URL does not adjust, it still shows “localhost”. (Server restarted, gitlab-runner servive restart). At best this should not use the hostname at all, but the IP.

Could it be that the server’s hostname is stored somewhere in the original repo that I cloned when the hostname was still localhost? The projects .git/config shows the correct IP:

[remote "origin"]
    url =

I found another questions that mentions a way to add other hosts to gitlab-runner’s config.toml, like

    extra_hosts = ["ci.mygitlab:"]

But I must use the shell executor, not docker.

Found a solution

As described here, the solution is to replace the entry host: localhost in the Github config file /home/git/gitlab/config/gitlab.yml with the IP address of the host.

My answer is also here: