Skip to content
fatal: unable to access '...': Could not resolve host

fatal: unable to access '...': Could not resolve host

DodaTech 2 min read

Git’s “fatal: unable to access: Could not resolve host” means your system can’t convert the repository hostname into an IP address — DNS resolution failed entirely.

What It Means

When you run git clone, git fetch, or git push, Git first needs to resolve the hostname to an IP address via DNS (Domain Name System). If DNS resolution fails, Git can’t connect at all — no TCP connection is even attempted. The error is purely about hostname resolution, not authentication or protocol issues. This is almost always a network configuration problem at the OS level.

Why It Happens

  • No internet connection — you’re offline or the network is down.
  • DNS server is unavailable or misconfigured on your system.
  • A VPN or corporate network blocks external DNS lookups.
  • Git is configured with an HTTP/HTTPS proxy that’s unreachable.
  • The hostname is misspelled in the Git remote URL.
  • The remote server (GitHub, GitLab, Bitbucket) is temporarily down.

How to Fix It

Step 1: Check your internet connection

ping -c 3 8.8.8.8
# If this works but github.com doesn't, it's a DNS issue

Step 2: Test DNS resolution

nslookup github.com
# Or
dig github.com

If these fail, configure a public DNS server like Google DNS (8.8.8.8) or Cloudflare (1.1.1.1).

Step 3: Check Git proxy configuration

A misconfigured proxy can block hostname resolution:

git config --global --get http.proxy
git config --global --get https.proxy

If a proxy is set and shouldn’t be, remove it:

git config --global --unset http.proxy
git config --global --unset https.proxy

Step 4: Verify the remote URL

git remote -v
# Check for typos: github.co instead of github.com
git remote set-url origin https://github.com/user/repo.git

Step 5: Temporarily disable VPN or firewall

If you’re behind a VPN, try disconnecting and testing again:

# Disconnect VPN, then test
ping github.com
git fetch

Step 6: Flush DNS cache

On Linux:

sudo systemd-resolve --flush-caches
# Or
sudo resolvectl flush-caches

On macOS:

sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

On Windows:

ipconfig /flushdns
Can a specific repo's remote URL cause this error?
Yes — if the URL contains a typo or an unreachable hostname (e.g., https://githib.com/user/repo.git instead of github.com), DNS will fail. Check the URL with git remote -v and correct it with git remote set-url origin <correct-url>.
Does this error mean Git is broken?
No — Git is working correctly. It’s telling you that the network layer below Git can’t resolve the hostname. The problem is in your system’s DNS configuration, proxy settings, or internet connection. Fix the network issue, and Git commands will work normally again.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro