Skip to content

Could not resolve host: github.com #4872

Closed

Description

@shiv1490

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

Activity

  1. niik commented on Jun 5, 2018

    @niik
    Member

    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 #1998, #2789

  2. added
    more-info-needed
    on Jun 5, 2018
  3. shiv1490 commented on Jun 11, 2018

    @shiv1490
    Author

    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:[email protected]:8080

    Thanks

  4. imsrgadich commented on Aug 14, 2018

    @imsrgadich

    Check this out as well. it helped me.

    git config --global --unset http.proxy 
    git config --global --unset https.proxy
    
  5. DoganM95 commented on Nov 27, 2018

    @DoganM95

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

  6. kutajay commented on Feb 3, 2019

    @kutajay

    Tried the following
    git config --global http.proxy http://proxyuser:[email protected]: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?

  7. SethuSP commented on Apr 4, 2019

    @SethuSP

    Tried the following
    git config --global http.proxy http://proxyuser:[email protected]: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?

    I too tried the same. It does not work for me as well and i do not think it is related to internet strength. Not sure why.

  8. JCDigital27 commented on Apr 12, 2019

    @JCDigital27

    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

  9. davidbeery commented on Jun 17, 2019

    @davidbeery

    Why does this fix work?
    What is it about the http/s.proxy global config that interferes with the internet connection?

  10. steveward commented on Jun 17, 2019

    @steveward
    Contributor

    @davidbeery The --unset flag can fix the issue where Git will attempt to establish a connection through an invalid proxy configuration (i.e. the user is actually not behind a proxy), which causes Git operations to error out. If you are using a proxy then you will want to keep that proxy configuration line in order to ensure Git operations work successfully.

  11. RoderickKennedy commented on Sep 5, 2019

    @RoderickKennedy

    @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

  12. manishak-kumari commented on Sep 16, 2019

    @manishak-kumari

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

  13. sadkisoft commented on Sep 19, 2019

    @sadkisoft

    Please i need a help
    My code is :

    $url="https://api.sellercenter.net/?Action=GetProducts&UserID=***&Signature=***&Format=JSON";
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));

    	$parsee = curl_exec($ch);
    	$result=json_decode($parsee,false); 
    	$errno = curl_errno($ch);
    	$errmsg = curl_error($ch);
    	$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    	curl_close($ch);
    	var_dump($errno, $errmsg, $httpcode, $parsee);
    

    the result is 👍
    int 6
    string 'Could not resolve host: api.sellercenter.net; Host not found' (length=60)
    int 0
    boolean false

  14. 72 remaining items

  15. Naggenda commented on May 24, 2023

    @Naggenda

    Check this out as well. it helped me.

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

    this worked for me

  16. SriSomanaath commented on Jun 10, 2023

    @SriSomanaath

    thanks this worked for me
    git config --global --unset http.proxy

  17. Zahid43300 commented on Jun 24, 2023

    @Zahid43300

    None of this worked for me can anyone help me 🥲 i am using kali linux on phone

  18. mahfuz-swe commented on Jul 23, 2023

    @mahfuz-swe

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

    Upon commands helped me, you can try also

  19. davik4life commented on Sep 27, 2023

    @davik4life

    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.

  20. alvinChristianto commented on Dec 7, 2023

    @alvinChristianto

    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.

  21. EduMRX commented on Jan 2, 2024

    @EduMRX

    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.

  22. Goku9689 commented on Apr 15, 2024

    @Goku9689

    fix git clone unable resolve hosts name
    vi /etc/hosts
    in this and localhosts and localdomain like 127.0.0.1. and it's opposite section mention localhosts and localdomain
    sudo service networking restart
    and start git clone
    Uploading Screenshot_20240415-211909.png…

  23. CodeNKoffee commented on Jun 26, 2024

    @CodeNKoffee

    The error message you're seeing,fatal: unable to access 'https://github.com/....': Could not resolve host: github.com, suggests a DNS resolution issue, meaning your computer is unable to find the IP address associated with github.com. This can be due to various reasons such as network connectivity issues, DNS server problems, or local DNS cache issues. Here are a few steps you can take to troubleshoot and potentially resolve the issue:

    1. Check your Internet connection:
      Ensure that your Mac is connected to the internet. You can try accessing other websites or pinging a well-known site.
    ping -c 4 google.com
    1. Flush your DNS cache:
      This can help if the issue is related to a corrupted or outdated DNS cache.
    sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  24. def-fun commented on Jul 9, 2024

    @def-fun

    To anyone who is using git CMD over socks5 proxy:

    if your computer failed to access github.com by git or curl command like next:

    C:\Users\admin>ping github.com
    Ping request could not find host github.com. Please check the name and try again.
    
    C:\Users\admin>curl -v github.com
    * Rebuilt URL to: github.com/
    * Could not resolve host: github.com
    * Closing connection 0
    curl: (6) Could not resolve host: github.com
    
    C:\Users\admin>curl -v github.com --proxy socks5://192.168.29.1:1080
    * Rebuilt URL to: github.com/
    *   Trying 192.168.29.1...
    * TCP_NODELAY set
    * SOCKS5 communication to github.com:80
    * Could not resolve host: github.com
    * Closing connection 0
    curl: (6) Could not resolve host: github.com

    and if you can get 301 redirect over a socks5 proxy:

    # `20.205.243.166` is the IP of github.com, you can found it at https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-githubs-ip-addresses
    # `192.168.29.1:1080` is your socks5 proxy
    C:\Users\admin>curl -v 20.205.243.166 --proxy socks5://192.168.29.1:1080
    * Rebuilt URL to: 20.205.243.166/
    *   Trying 192.168.29.1...
    * TCP_NODELAY set
    * SOCKS5 communication to 20.205.243.166:80
    * SOCKS5 connect to IPv4 20.205.243.166 (locally resolved)
    * SOCKS5 request granted.
    * Connected to 192.168.29.1 (192.168.29.1) port 1080 (#0)
    > GET / HTTP/1.1
    > Host: 20.205.243.166
    > User-Agent: curl/7.55.1
    > Accept: */*
    >
    < HTTP/1.1 301 Moved Permanently
    < Content-Length: 0
    < Location: https://20.205.243.166/
    <
    * Connection #0 to host 192.168.29.1 left intact

    it means that your computer failed to resolve DNS but your proxy socks5 works and you can use git over this proxy when configured properly.

    using http:// or socks5h:// (not socks5://) will enable your git to access github.com

    git config --global http.proxy http://192.168.29.1:8088   # use http proxy
    git config --global https.proxy socks5h://192.168.29.1:1080   # or use socks5 proxy
    git clone https://github.com/abhinavsingh/proxy.py
  25. jlmwangi commented on Feb 16, 2025

    @jlmwangi

    none of the solutions worked for me

  26. ziyoviddin7 commented on Mar 23, 2025

    @ziyoviddin7

    It worked for me:
    1)Open the DNS configuration file:
    sudo nano /etc/resolv.conf

    2)Add the following lines:

    nameserver 8.8.8.8.8
    nameserver 1.1.1.1.1
    

    3)Save the file (Ctrl + O, then Enter) and close it (Ctrl + X)

    1. Restart the network service:
      sudo systemctl restart systemd-networkd
      or
      sudo systemctl restart NetworkManager
      or
      sudo systemctl restart networking
  27. Prachi-Kurhade commented on Nov 10, 2025

    @Prachi-Kurhade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    more-info-needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions