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.comCommon 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
- Resolve the host directly to confirm DNS works at all.
- Check whether a proxy is required for egress.
Terminal
getent hosts github.com || nslookup github.com
curl -sSf https://github.com >/dev/null && echo reachableConfigure the proxy if required
- Set http_proxy / https_proxy for the runner.
- Mirror it into Git config so clones use the proxy.
Terminal
git config --global http.proxy http://proxy.internal:8080How 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
Git "RPC failed; curl 56 / HTTP 500" on a large clone in CIFix the Git "RPC failed; curl 56" and "HTTP 500" errors when cloning a large repository in CI, caused by conn…
Git "The remote end hung up unexpectedly" in CIFix the Git "fatal: The remote end hung up unexpectedly" error in CI, caused by the server closing the connec…
Docker "ERROR: load metadata" rate limit in CIFix the Docker "failed to load metadata for docker.io" rate-limit error in CI, caused by anonymous Docker Hub…