What "Could Not Resolve Host Github.com" means

Could not resolve host github.com means your computer tried to reach GitHub but could not find it — not because GitHub is down, but because your computer could not translate the address github.com into the IP address it needs to connect. This is a DNS problem, not a GitHub problem. Your computer asks a DNS server "where is github.com?" and either gets no answer, a wrong answer, or cannot reach the DNS server at all.

This error stops you from cloning repositories, pushing code, or visiting github.com in your browser. It looks different depending on where you see it: in a terminal it says "Could not resolve host", in a browser it says "This site can't be reached" or "DNS_PROBE_FINISHED_NXDOMAIN", in Git it says "Could not resolve host: github.com". The cause is the same in all three.

Key Takeaways

  • DNS resolution failures usually mean your computer cannot reach the DNS server it is configured to use, not that GitHub itself is unreachable.
  • Restart your router first — most DNS problems clear when the router reconnects to your ISP's DNS servers.
  • If restarting does not work, change your DNS server to a public one like 8.8.8.8 (Google) or 1.1.1.1 (Cloudflare) to test whether your ISP's DNS is the problem.
  • Check your firewall and antivirus software — they can block DNS queries or intercept HTTPS connections to github.com even when your internet works otherwise.
  • On a home network, a misconfigured router or a compromised device can poison DNS for all devices on the network.

How DNS resolution works and where it breaks

When you type github.com into your browser or run git clone, your computer does not know where to send the request. It asks a DNS server: "What is the IP address for github.com?" The DNS server answers with a number like 140.82.113.4. Your computer then connects to that IP address.

The error happens at the question stage. Your computer either cannot reach the DNS server it is configured to use, or the DNS server cannot answer. Your router is usually configured to use your ISP's DNS servers by default. If your router loses connection to those servers, or if you manually configured a DNS server that is down or unreachable, every domain lookup fails.

This is different from a connection problem. You might be able to ping your router, load a website you have visited before (because it is cached), or use other services — but any new domain lookup will fail. GitHub is just the first place you noticed.

Restart your router and modem first

Most DNS problems clear when you restart your router. Power it off completely, wait 30 seconds, and power it back on. While it restarts, your ISP's DNS servers will reconnect and your router will re-register with them.

If you have a separate modem (a device between your wall outlet and your router), restart that first, then restart the router. Wait for all lights to stabilize — usually two to three minutes — before testing. Open a terminal and type nslookup github.com on Windows or Mac, or dig github.com on Linux. If you see an IP address in the answer, DNS is working again.

If restarting does not work, leave the router off for a full minute before powering it back on. Some routers need longer to fully reset their connection to the ISP.

Switch to a public DNS server to isolate the problem

If your router restart did not fix it, change your DNS server to test whether your ISP's DNS is the problem. Google's public DNS is 8.8.8.8 and 8.8.4.4. Cloudflare's is 1.1.1.1 and 1.0.0.1. These are free, public, and usually faster than ISP DNS servers.

On Windows, open Settings > Network & Internet > WiFi (or Ethernet) > Change adapter options. Right-click your connection, choose Properties, select Internet Protocol Version 4, and click Properties. Change the DNS server from "Obtain DNS server address automatically" to "Use the following DNS server addresses" and enter 8.8.8.8. Click OK and test.

On Mac, open System Preferences > Network > WiFi (or Ethernet) > Advanced > DNS. Click the + button and add 8.8.8.8. Click OK and test. On Linux, edit /etc/resolv.conf and change the nameserver line to nameserver 8.8.8.8.

If github.com resolves after switching to public DNS, your ISP's DNS server is the problem. Contact your ISP or keep using the public DNS. If it still does not resolve, the problem is elsewhere.

Check your firewall and antivirus software

Firewalls and antivirus programs can block DNS queries or intercept HTTPS traffic to github.com. Windows Defender, macOS security features, and third-party antivirus software all do this. The error message looks the same whether DNS is actually blocked or the firewall is intercepting the connection.

Temporarily disable your antivirus software and try again. If github.com loads, add github.com to your antivirus whitelist or exclusion list. Do not leave antivirus disabled permanently — re-enable it after testing.

Check your firewall rules too. On Windows, open Windows Defender Firewall > Allow an app through firewall and look for Git or your terminal process. On Mac, System Preferences > Security & Privacy > Firewall Options shows what is blocked. If you use a third-party firewall, check its settings for rules that block github.com or port 443 (HTTPS).

Test from another device on your network

If only one device cannot reach github.com, the problem is on that device — firewall, DNS settings, or antivirus. If all devices on your network have the problem, the issue is your router or ISP connection.

Try github.com on your phone using WiFi. If your phone can reach it and your computer cannot, the problem is your computer's firewall, DNS settings, or antivirus. If your phone also cannot reach it, restart your router. If the router restart does not work, your ISP's DNS or internet connection is down.

You can also test from a different network entirely — a phone hotspot, a coffee shop WiFi, or a friend's home network. If github.com works on a different network, your home network or ISP is the problem.

Clear your DNS cache and flush your network settings

Your computer caches DNS answers to avoid asking the same question twice. If the cache is corrupted, it can return the wrong answer or no answer at all. Clearing it forces your computer to ask the DNS server again.

On Windows, open Command Prompt as administrator and type ipconfig /flushdns. On Mac, open Terminal and type sudo dscacheutil -flushcache. On Linux, type sudo systemctl restart systemd-resolved or sudo /etc/init.d/nscd restart depending on your distribution.

If clearing the cache does not work, reset your network settings. On Windows, open Settings > Network & Internet > Status > Network reset and click "Reset now". On Mac, System Preferences > Network, select your connection, click Advanced, go to TCP/IP, and click "Renew DHCP Lease". These steps force your computer to re-negotiate its connection to your router and DNS servers.

Check for a compromised device on your network

On a home network, a single compromised device can poison DNS for all other devices. Malware can change your router's DNS settings, redirect DNS queries to a malicious server, or intercept traffic to github.com. If all devices on your network cannot reach github.com, and restarting your router and switching to public DNS did not work, check your router's settings.

Log into your router's admin panel — usually 192.168.1.1 or 192.168.0.1 in your browser. Look for DNS settings and check what DNS servers are configured. If they are not your ISP's servers or a public DNS you intentionally set, something has changed them. Reset your router to factory defaults and reconfigure it from scratch. Write down your WiFi password first — you will need to set it again.

If you see unfamiliar devices connected to your WiFi, disconnect them and change your WiFi password. Run a full antivirus scan on your computer and any other devices that use your network.

Frequently Asked Questions

Why does github.com fail but other websites work?

GitHub might be cached in your browser or your DNS cache from before the problem started, so you can load it without a new DNS lookup. Or your firewall is specifically blocking github.com. Try a domain you have never visited before — if that also fails, DNS is broken. If only github.com fails, check your firewall rules and antivirus whitelist.

Does this mean GitHub is hacked or down?

No. This error is on your side, not GitHub's. GitHub's status page at status.github.com would show if the service was down. If you see "Could not resolve host", your computer cannot find GitHub's address — GitHub itself is fine.

Will changing my DNS server to 8.8.8.8 hurt my privacy?

Google can see which domains you look up when you use 8.8.8.8. Your ISP can see the same thing with their DNS. If privacy is a concern, use Cloudflare's 1.1.1.1 instead — they log less data and delete logs after 24 hours. For maximum privacy, use a VPN, which encrypts DNS queries so your ISP cannot see them.

What if I am behind a corporate firewall or school network?

Your network administrator might be blocking github.com intentionally. Try from a different network to confirm. If it works elsewhere, contact your network administrator and ask them to whitelist github.com. You cannot fix this yourself on a corporate or school network.

Should I restart my computer or just my router?

Restart your router first — it is faster and solves most DNS problems. Restarting your computer clears your DNS cache and resets network settings, so try that second if the router restart does not work. Restart your modem only if you have one and the router restart did not work.