Fatal Error : Can't resolve host github.com

59,282

Solution 1

This solved my problem:

http version:

git config --global --unset http.proxy

https version:

git config --global --unset https.proxy

Solution 2

In Windows, if you've any third party firewall (or internet activity monitor) installed, then configure them to allow your client to access outside connection.

If there aren't any 3rd part firewallls, then go to control panel, search for firewall. Inside the firewall panel, select Add a new exception (or similar option). Allow the git client both inbound and outbound access.

Solution 3

I recomend you to switch to ssh.

You can get github ssh link from same place where https one. Then you just have to generate/add your ssh key to github profile. And that's it.

Share:
59,282

Related videos on Youtube

Vini
Author by

Vini

I started using SO in 2014 during my first development job in C#. Ever since I have been reading and learning a lot from SO. I am person with great hopes in Entrepreneurship but not forgetting the development skills that I have learned so far and still learning. I always am open to opportunities to meet people and learn new things. I always love the moment when I can think, "I would have never thought about it this way". Technology and people never cease to amaze me.

Updated on July 09, 2022

Comments

  • Vini
    Vini almost 2 years

    I am trying to push files to my remote repository from my local repository and I see this

    fatal error : fatal: unable to access 'https://github.com/vinivasundharan/abcd.git/': Couldn't resolve host 'github.com'

    My computer is not using any Proxy because I have seen methods to resolve the issue when Proxy is being used.

    I have tried the solutions from this and this. But both doesn't seem to help. My system has an active internet connection using Windows 7.

    UPDATE

    git config -l returns the following. I had to post it because I do not what exaclty this means

    core.symlinks=false
    core.autocrlf=true
    color.diff=auto
    color.status=auto
    color.branch=auto
    color.interactive=true
    help.format=html
    http.sslcainfo=C:/Users/vav9sw/AppData/Local/Programs/Git/mingw64/ssl/certs/ca-bundle.crt
    diff.astextplain.textconv=astextplain
    rebase.autosquash=true
    user.name=xyz
    [email protected]
    core.repositoryformatversion=0
    core.filemode=false
    core.bare=false
    core.logallrefupdates=true
    core.symlinks=false
    core.ignorecase=true
    core.hidedotfiles=dotGitOnly
    remote.origin.url=https://github.com/vinivasundharan/abcd.git
    remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*`
    

    EDIT

    Just to make sure that i have followed the steps to Upload the file to GitHub check the attached image to see the steps i have followed.

    steps

    • JDurstberger
      JDurstberger over 8 years
      so you can visit github via your browser?
    • Vini
      Vini over 8 years
      yes. I can visit the website. i cant see any files in the folder though
    • Tim Biegeleisen
      Tim Biegeleisen over 8 years
      Have you configured/changed your SSL settings?
    • VonC
      VonC over 8 years
      Does git config -l returns lines with 'proxy' in them?
    • Vini
      Vini over 8 years
      i haven't changed any SSL settings
    • Vini
      Vini over 8 years
      @VonC: check the updated question. I have added what it returned when i executed the git config-l
    • John Szakmeister
      John Szakmeister over 8 years
      It seems more like a DNS issue. Does ping github.com work from the command prompt? If not, the problem is with your network/network settings.
    • Vini
      Vini over 8 years
      @jszakmeister : You are right. ping doesnt work. But it doesnt work for google.com either. It keeps on showing Request timed out What change could be made to get it working. If there is a dns issue will i be able to access websites from my system?
    • John Szakmeister
      John Szakmeister over 8 years
      Hard to say--and StackOverflow isn't really the place for the answer. I don't run Windows these days (I'm a Linux/OS X guy--I abandoned Windows at home some time in 2001). The things I would check are that you are getting a valid ip address and that a valid DNS server is being assigned (you should be able to ping whatever address is being provided). I can't tell you how to fix any of it--many problems are very specific to an environment. And no, if ping github.com and ping google.com are failing to resolve the ip address, you will not likely be able to access other websites.
    • Vini
      Vini over 8 years
      Do you think i should migrate the question to another SE site? But i am able to access all websites. But the ping doesnt work. :(
    • VonC
      VonC over 8 years
      can you clone again that repo? (and try and push from the new clone?). Also, what does a set GIT_CURL_VERBOSE=1; git push returns?
    • Vini
      Vini over 8 years
      @VonC : it returns the usual warning that i get when tryin to use git push instead of git push origin master
    • VonC
      VonC over 8 years
      @ViniVasundharan Were you able to clone that repo? (in a new local folder)
    • Vini
      Vini over 8 years
      @VonC: When I try using git clone https://github.com/vinivasundharan/testnew1.git it shows couldnt resolve host. I can`t clone from the remote repository to the desktop as well. It fails as well.
    • VonC
      VonC over 8 years
      OK. export GIT_CURL_VERBOSE=1: after that a git clone is supposed to show a bit more. But if it shows only Couldn't resolve host 'github.com', then try the same from a CMD (not a bash session)
    • Vini
      Vini over 8 years
      Ok i get the fatal error again. I really do not know how i could do the same in a cmd. I tried executing the commands from the folder where the local git repository is saved. But it doesn't identify any of the git commands.
  • Vini
    Vini over 8 years
    I do not have access tot he firewall settings in my system . :( Maybe it is possible that that is the issue. So it ends up in such a way that I will not be able to use github.
  • Vini
    Vini over 8 years
    I am sorry I cant accept this as the answer as I could never check if this solution would achieve what I am looking for..
  • hhkaos
    hhkaos almost 7 years
    Me neither, by the way I'm using Mac