Skip to content
Latchkey

Git "Could not resolve host" in CI

Git could not turn the hostname into an IP address. DNS resolution failed before any connection was attempted, which is a runner network or proxy problem rather than anything about the repo.

What this error means

A clone or fetch fails immediately with fatal: unable to access ...: Could not resolve host: github.com. It is often intermittent or affects only some runners.

git
fatal: unable to access 'https://github.com/org/repo.git/': Could not resolve host: github.com

Common causes

Transient DNS failure

A momentary resolver outage on the runner network causes the lookup to fail and usually succeeds on retry.

Missing or wrong proxy configuration

A runner behind a proxy without http(s)_proxy set, or with a stale proxy, cannot resolve external names.

Restricted egress

A locked-down network blocks DNS or only allows specific hosts, so github.com never resolves.

How to fix it

Verify DNS and connectivity

  1. Resolve the host directly to confirm DNS works at all.
  2. Check whether a proxy is required for egress.
Terminal
getent hosts github.com || nslookup github.com
curl -sSf https://github.com >/dev/null && echo reachable

Configure the proxy if required

  1. Set http_proxy / https_proxy for the runner.
  2. Mirror it into Git config so clones use the proxy.
Terminal
git config --global http.proxy http://proxy.internal:8080

How to prevent it

  • Run CI on runners with reliable DNS and correct proxy settings. Latchkey managed runners auto-retry transient resolution failures, so a brief DNS blip does not fail an otherwise healthy job.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →