could not resolve host github.com error while cloning remote repository in git

What I did: I have created a remote repository on Github and I am trying to clone the remote repository on my local machine. While cloning I am providing the clone URL & target folder.

But every time I try to clone, I am getting this error:

  • How do you manage git pre-commit hooks in a team in automated way?
  • Disallow branching from and merge of specific branches
  • How to get the changes on a branch in Git
  • How can I split a single file from a git repo into a new repo?
  • Versioning large text files in git
  • Change Git repository download path on Mac
  • Error: “fatal: unable to access ‘https://github.com/hyperion057/spring-repo.git/’: Could not resolve host: github.com”

    What do I need to do to connect to GitHub ?

  • How to version control a rails plugin and the testing app together
  • synchronize between 2 git repositories
  • Git list : viewing git repositories in home folder
  • Strong access control for Gollum?
  • I just installed EGit on Eclipse — but Where is it?
  • Where does it make sense to branch from when basically rewriting the codebase, if at all?
  • 20 Solutions collect form web for “could not resolve host github.com error while cloning remote repository in git”

    do i need to configure proxy settings? because my office has got proxy servers.

    Yes, you can do so by setting HTTP_PROXY, and HTTPS_PROXY environment variables.

    See “Syncing with github”:

    set HTTPS_PROXY=http://<login_internet>:<password_internet>@aproxy:aport
    set HTTP_PROXY=http://<login_internet>:<password_internet>@aproxy:aport
    set NO_PROXY=localhost,my.company
    

    Note the NO_PROXY, to allow to access internal site to your company

    You also can register that in your git config:

    git config --global http.proxy http://<login_internet>:<password_internet>@aproxy:aport
    

    I got a similar error, and it’s caused by incorrect proxy setting. This command saved me:

    git config --global --unset http.proxy
    

    https version:

    git config --global --unset https.proxy
    

    another possibility, I ran into this problem myself. But it was after I had installed a VPN (which was unrelated and running)

    turning off the VPN, fixed the issue.

    for the record, I was running “Viscosity” VPN on my MacBookPro

    192.30.252.128 is the current IP of github.com which can be set in your local DNS (/etc/hosts in Linux and C:\Windows\System32\drivers\etc\hosts)

    Spent a couple hours trying to fix this.

    Re-connecting my wifi did the trick.

    I’ve had the same issue after running out of disk space. Closing and reopening terminal fixed it one time. Restarting my Mac the next.

    Time to delete some iPhone backups…

    Would like to add, because I didn’t do it, once you’ve entered:

    git config --global --unset http.proxy
    

    make sure to quit and restart terminal. Mine didn’t resolve until I did that.

    Thanks so much, issue was killing me!

    In my case, on a Windows box, my TCP/IP stack seems to have needed to be reset. Resetting the TCP/IP stack of the client PC caused git to start behaving properly again. Run this command in Administrator mode at a command prompt and retry the git command:

    netsh int ip reset
    

    Manually disabling and re-enabling the network adapter via the Control Panel produces a similar result.

    I suspect DNS resolution problems inside the TCP stack on my Windows box.

    I had this very similar error as following.

    C:\wamp\www\myrepository [master]> git push
    fatal: unable to access 'https://github.com/myaccount/myrepository.git/': Couldn't resolve host 'github.com'
    

    Actually, the prompt message has told us where’s wrong.

    https://github.com/myaccount/myrepository.git/
    

    When I check my github, I found my github repository’s HTTPS url is

    https://github.com/myaccount/myrepository.git
    

    I don’t know how this happened. The wrong url has been set up by installed Git Shell automatically.

    Once I remove the ‘/’ at the end, I can push successfully.

    i have same issue and solve it by using this command

    $git config –global http.proxy http://enter_your_proxy:enter_port

    All,
    I want to let you all know that I was having this same issue. I solve it by resetting my remote URL git remote set-url origin https://new.url.here I found how to do this from this answer but I had to change hit to https: Change the URI (URL) for a remote Git repository

    When you tried above solutions and nothing helps, you may need to checkout your local network settings and try to add 8.8.8.8 and your local router ip to the DNS filed.

    Just in case future generations stuck in this too:
    For me what worked (on mac OSX) was to set my DNS with opendns
    208.67.222.222 , 208.67.220.220. I get this numbers here: https://www.opendns.com. For some reason, my dns configuration reseted to the default numbers (my local ip I guess), and I was not able to connect to neither github, brew or rubygems. Sorry for the misspelling.

    This solve the issue

    git config --global --unset http.proxy
    

    or https

    git config --global --unset https.proxy
    

    Today I face with the same issue, this is also providing another possibility. I did all suggestions above but still seeing the issue. I have no way but restart my mac…. Problem solved….

    As a suggestion for Ubuntu servers, you can write down essid and password of router in your /etc/network/interfaces file:

    iface [en0 || your wireless driver no necessarily en0] inet static
        address 192.168.1.100 / (something for your static ip between 1-255)
        netmask 255.255.255.0
        gateway 192.168.1.1 / (this is the ip of your router)
        dns-nameservers 8.8.8.8 / (you can use whatever you want)
        wpa-ssid qwertyuio / (this is router id)
        wpa-psk qwertyuio / (this is router password for wireless connection)
    

    When I got this error while pulling a repository to my server, I wrote wpa-ssid and wpa-psk and restarted. Then it worked.

    EDIT: I faced the same issue again and this time it was because of the inconsistency in router signal levels. My connection was not strong, that was the problem. However, the solution above is a real solution for static ip

    Edge case here but I tried (almost) all of the above answers above on VirtualBox and nothing was doing it but then closing not only the VirtualBoxVM but good ole VirtualBox itself and restarting the program itself did the trick without 0 complaint.

    Hope that can help ~0.1% of queriers : )

    very sample, open one new terminal, do git again.

    the simple solution to removing extra “/” from git clone remote is putting the url in parentheses. git clone ” “

    One reason for this issue could be wrong/empty /etc/resolv.conf file.

    The way I resolved this issue in my centos 7 minimal is as follows:
    my /etc/resolv.conf was empty and I added the following lines:

    nameserver 192.168.1.1
    nameserver 0.0.0.0
    

    where 192.168.1.1 is my gateway, in your case it can be different.

    Git Baby is a git and github fan, let's start git clone.