Software⏱️ 2 min read📅 2026-05-31

How to Fix: Git: Could not resolve host github.com error while cloning remote repository in git

Git error resolving host github.com while cloning a remote repository.

Quick Answer: Check your internet connection and ensure that the GitHub website is accessible. Try using the 'git config --global http.proxy' command to set a proxy server if you're behind a firewall or have issues with DNS resolution.

The error message 'Could not resolve host: github.com' indicates that your system is unable to find the IP address of the GitHub server. This can be due to a few reasons such as DNS resolution issues, network connectivity problems or incorrect DNS settings.

💡 Why You Are Getting This Error

  • One of the possible causes is that your system's DNS cache is not up to date or it has been configured incorrectly.

🔧 Proven Troubleshooting Steps

Method 1: Update DNS Cache

  1. Step 1: Open your system's command prompt or terminal and type the command 'ipconfig /flushdns' (for Windows) or 'sudo dscacheutil -flushcache' (for Mac). This will clear out any existing DNS cache entries.

Method 2: Use a Proxy Server

  1. Step 1: Check if your network administrator has set up a proxy server. If yes, then you need to configure the proxy settings in your Git client.

✨ Wrapping Up

By following these steps, you should be able to resolve the 'Could not resolve host: github.com' error and successfully clone your remote repository.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions