[SOLVED] ssh could not resolve hostname github.com temporary failure in name resolution

The “temporary failure in name resolution” error message typically indicates a problem with your system’s DNS (Domain Name System) resolution process. This error occurs when your computer or network cannot resolve domain names into their corresponding IP addresses.

If you see the error: ssh could not resolve hostname github.com temporary failure in name resolution while cloning a repository, the most likely problem is with your DNS settings.

dev@codetryout:~$ git clone [email protected]:codetryout/codetryout.git
Cloning into 'codetryout'...
ssh: Could not resolve hostname github.com: Temporary failure in name resolution
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

While this error message is clear, it could not resolve the name, which can sometimes be confusing.

Solution for GitHub Temporary failure in name resolution – the DNS error

The git command tells us it cannot reach the DNS server. We can check whether the internet and DNS service are available. I found my default DNS entry could not provide DNS service (by simply doing a test ping google.com ).

The problem was solved by adding DNS entries and (DNS service IP addresses from Google) to the resolv.conf file:

# cat /etc/resolv.conf

Note:- if you find several lines starting with the # (comments), you may leave it there or delete it and only keep this DNS IP address. Comments have no effects.

Related articles: How to set DNS servers to Google DNS or Cloudflare DNS

Verifying the git clone command again

Let us try running a git clone command again

dev@codetryout:~$ git clone [email protected]:codetryout/codetryout.git
Cloning into 'codetryout'...
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 27 (delta 8), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (27/27), 9.49 KiB | 3.16 MiB/s, done.
Resolving deltas: 100% (8/8), done.

This is tested on Ubuntu Linux. Save configurations will work on other Linux servers or inside docker containers.

Other possible causes of this error

Another possibility of this network error is the network blocking caused by your company firewall or the VPN. , You could try disconnecting (after you obtain permission from your company to do so!) from the VPN and rerunning the git command.

Here are a few possible causes and troubleshooting steps you can try to resolve the issue:

  1. Check your internet connection: Ensure you have a stable and active internet connection. If you are experiencing network connectivity problems, it can affect the DNS resolution process. Try accessing other websites or services to verify your internet connection works correctly.
  2. DNS server issues: Your DNS server may be experiencing problems. You can try changing your DNS server settings to a different provider, such as Google DNS ( and or Cloudflare DNS ( and Instructions for changing DNS settings vary depending on your operating system.
  3. Firewall or security software: Check if your firewall or security software is blocking DNS requests. Temporarily disable any firewall or security software you have installed and check if the name resolution issue persists. If the problem resolves after disabling the software, you may need to adjust the settings or whitelist the necessary DNS traffic.
  4. Flush DNS cache: Clearing your DNS cache can help resolve temporary resolution failures. The method to flush the DNS cache depends on your operating system. For example, open the command prompt as an administrator on Windows and type the command “ipconfig /flushdns“.
  5. Network configuration issues: Ensure that your network settings are correctly configured. Verify that your computer obtains the correct DNS server addresses automatically or set them manually if required.
  6. Router or modem issues: Restart your router or modem to ensure they function correctly. Sometimes, network equipment can encounter issues that affect DNS resolution.

If the problem persists after trying these troubleshooting steps, contacting your internet service provider (ISP) or network administrator may be helpful for further assistance. They can provide specific guidance based on your network setup and help resolve any underlying network issues causing the name resolution problem.