desktop: Could not resolve host: github.com

Description

I create a new repository in my local and complete the changes . After that I opened my github desktop to push the changes to my GitHub repo. As soon as i click the publish button it gave me this error

Version

  • GitHub Desktop:1.22
  • Operating system: windows 10 64 bit

Steps to Reproduce

Expected Behavior

Should publish new repository

Actual Behavior

gave this error - fatal: unable to access ‘https://github.com/shiv1490/Burger-Builder.git/’: Could not resolve host: github.com

Additional Information

Logs

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 93 (10 by maintainers)

Most upvoted comments

Check this out as well. it helped me.

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

Hi All, Issue is resolved now. This was happening because I was behind a corporate proxy. I used below commnad to resolve the issue

git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080

Thanks

This method works for me! reboot> then establish connection to internet… then> #git config --global --unset http.proxy #git config --global --unset https.proxy then> #git clone https://(…).git

Tried the following git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080 and git config --global --unset http.proxy git config --global --unset https.proxy but none seems to work for me; could it be a possible internet strength isssue?

Hi everybody!

I had the same problem and I solved differently. First, I was getting the error, because I created the Local repo and initialized before I had an online instance of the repo. Then manually, online in my git hub account created the repo to push my local files on it. When I tried to push the local repo into the online I got the error.

Solution:

  1. Remove the origin to clear out the initialization by: git remote rm origin

  2. Then try again the command lines: git remote add “your link to the repo”.git git push -u origin master

Hope this help somebody.

Hey @shiv1490. This error message seems to indicate a connectivity problem. Do you currently have any antivirus software installed other than the default antivirus that ships with Windows?

Additionally, are you using a proxy server to access the internet? Git requires special configuration to work behind proxy servers, see https://github.com/desktop/desktop/issues/1998, #2789

in my case it was a firewall rule (cmd not having internet permission), created by the company i work for

@JCDigital27 i have the same problem, whe i use the solution, but it not work? when i use curl -I https://github.com, it show the error. curl: (6) Could not resolve host: github.com; Unknown error

Check this out as well. it helped me.

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

Thank @imsrgadich. it worked for me.

Make sure Wi-Fi is on.

@shiv1490 👍 the command worked with me. git config --global http.proxy http://proxyuser:proxypwd@proxy.servers should i copy and paste the same line given by you above or i need to do some change?

git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080 its not worked for me

In case you get this error even on curl -I https://github.com – it’s all about DNS. You can clear your DNS cache to resolve this issue

linux: sudo systemd-resolve --flush-caches mac: sudo killall -HUP mDNSResponder

I solved this error by using below command

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

Check this out as well. it helped me.

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

This helped buddy

git config --global --unset http.proxy

make sure to quit and restart terminal.

Disconnect the VPN and Reconnect the VPN resolved the connection issue for me.

All the solutions you proposed did not work for me. Anything else to propose?

Se você está enfrentando problemas de resolução de host no Kali Linux e precisa resolver o problema temporariamente, pode criar um script que ajuste as configurações do arquivo /etc/resolv.conf. Certifique-se de entender que esta é uma solução temporária, e você deve procurar corrigir o problema subjacente com as configurações de rede ou DNS em seu ambiente. Aqui está um exemplo de um script simples que você pode criar:

Crie um script chamado, por exemplo, fix_dns.sh:

**#!/bin/bash

# Backup do arquivo resolv.conf
sudo cp /etc/resolv.conf /etc/resolv.conf.backup

# Substitui as configurações do arquivo resolv.conf
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
echo "nameserver 8.8.4.4" | sudo tee -a /etc/resolv.conf

# Mensagem informativa
echo "Configurações DNS temporárias aplicadas. Tente novamente."

# Exemplo de comando para clonar o repositório Git após aplicar as configurações
# git clone https://github.com/niranjandasMM/TEST.git/

# Restaure as configurações originais (opcional)
# sudo cp /etc/resolv.conf.backup /etc/resolv.conf**

Certifique-se de tornar o script executável com o comando:

chmod +x fix_dns.sh

Execute o script com:

sudo bash fix_dns.sh

Este script faz backup do arquivo resolv.conf original, substitui temporariamente as configurações com servidores DNS públicos do Google (8.8.8.8 e 8.8.4.4) e exibe uma mensagem informativa. Lembre-se de que isso é uma solução temporária e não corrige o problema subjacente na configuração do seu ambiente.

in my case its because windows defender public firewall.

i use wsl2 ubuntu 20 distro, usually i can push and fetch, but after some changes in host windows, wsl2 cant push and fetch. The ping github.com also fail. after some searching for issue, i try disable windows defender public firewall, and then try to do git commands and it works again.

I encountered this same issue today for the first time and immediately noticed it had to do with my internet connectivity. I realized my internet router went off, which was the reason for the error. As soon as I went back online, the push command worked.

Disconnect the VPN and Reconnect the VPN resolved the connection issue for me.

thank you i fixed my problem

This method works for me! reboot> then establish connection to internet… then> #git config --global --unset http.proxy #git config --global --unset https.proxy then> #git clone https://(…).git

Thanks

None of these solutions work on Ubuntu 20.04, if anyone finds a solution to these for that OS, then please post here

I have no idea why but restart helped me (?)

I tried this but doesn’t work.

──(sanim㉿kali)-[~] └─$ git clone https://github.com/ZerBea/hcxdumptool.git 130 ⨯

Cloning into ‘hcxdumptool’… fatal: unable to access ‘https://github.com/ZerBea/hcxdumptool.git/’: Could not resolve host: github.com

┌──(sanim㉿kali)-[~] └─$ git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080

┌──(sanim㉿kali)-[~] └─$ git clone https://github.com/ZerBea/hcxdumptool.git Cloning into ‘hcxdumptool’… fatal: unable to access ‘https://github.com/ZerBea/hcxdumptool.git/’: Could not resolve proxy: proxy.server.com

┌──(sanim㉿kali)-[~] └─$ git config --global --unset http.proxy 128 ⨯

┌──(sanim㉿kali)-[~] └─$ git clone https://github.com/ZerBea/hcxdumptool.git Cloning into ‘hcxdumptool’… fatal: unable to access ‘https://github.com/ZerBea/hcxdumptool.git/’: Could not resolve host: github.com

┌──(sanim㉿kali)-[~] └─$ git config --global --unset https.proxy 128 ⨯

┌──(sanim㉿kali)-[~] └─$ git clone https://github.com/ZerBea/hcxdumptool.git 5 ⨯ Cloning into ‘hcxdumptool’… fatal: unable to access ‘https://github.com/ZerBea/hcxdumptool.git/’: Could not resolve host: github.com

┌──(sanim㉿kali)-[~] └─$ git config --global --unset http.proxy 128 ⨯

┌──(sanim㉿kali)-[~] └─$ git clone https://github.com/ZerBea/hcxdumptool.git 5 ⨯ Cloning into ‘hcxdumptool’… fatal: unable to access ‘https://github.com/ZerBea/hcxdumptool.git/’: Could not resolve host: github.com

https://stackoverflow.com/questions/20370294/git-could-not-resolve-host-github-com-error-while-cloning-remote-repository-in Check this link!