Pipeline/job fails immediately with "fatal: refusing to work with credential missing host field"

  • Describe your question in as much detail as possible:
    When running a pipeline, it fails almost immediately on “Getting source from git repository” with a fatal: refusing to work with credential missing host field error. This just happened one day on a previously working pipeline. The change was reverted, and even trying to re-run a previously working pipeline/job fails immediately with this error.

  • What are you seeing, and how does that differ from what you expect to see?

    This is what I see.

  • What version are you on? Are you using self-managed or GitLab.com?
    Self managed.

    • *GitLab - 13.9.3-ee
    • *Runner - 13.9.0-1
  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?
    I have:

  • Reverted the change I performed before the pipeline that failed.

  • Tried re-running a previously successful pipeline.

  • Reinstalled git on the remote host the runner SSH’s to.

  • Upgraded gitlab-ee from 13.6.3 to 13.9.3.

  • Upgraded gitlab-runner from 13.6.0-1 to 13.9.0-1

  • Removed the runner and re-created the runner for the project.

  • Run other pipelines on the same remote host without issue.

Googling the issue hasn’t revealed much but from this page t/t0300-credentials.sh · master · GitLab.org / Git · GitLab, which references this error message, I think the error is possibly being reported from a bad git credential. The problem is I have no idea how gitlab utilizes git credential if that is indeed the issue.

I’m really clutching at straws now, I feel like if I moved the project to a brand new one it might work again, (given that other projects still work), but I’d really like to know what caused this so it doesn’t happen if I move it to production.


I figured it out.

Prior to the issue I had added a couple of CI/CD variables “HTTP_PROXY” and “HTTPS_PROXY”, not realising this forces gitlab to use the proxy when doing the initial fetch of the repo. As I hadn’t whitelisted the hostname of my gitlab server, the fetch was failing and returning this error.

So essentially, you get this error if the runner/pipeline can’t connect from the remote host back to git.

Suggestion - It would be useful to have a clearer error indicating that the missing host field is due to a failed connection to the gitlab server.