Join the Stack Overflow Community
Stack Overflow is a community of 6.5 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

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:

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 ?

share|improve this question
    
What command are you using? Are you cloning by https or ssh? I just tried to clone your project and it worked. – Raul Rene Dec 4 '13 at 8:21
    
I am using git GUI and i'm cloning by HTTPS. – HyperioN Dec 4 '13 at 8:36
1  
Open a terminal and execute git clone git@github.com:hyperion057/spring-repo.git – Raul Rene Dec 4 '13 at 8:57
    
Now i am getting error- ssh: github.com:no address associated with name fatal: Could not read from remote repository – HyperioN Dec 4 '13 at 9:10
1  
The errors you are getting are basically telling you it cannot connect. You have probably set your proxy to the browser, but not on the entire machine. Try to set the proxy accordingly and try again. – Raul Rene Dec 4 '13 at 9:24

15 Answers 15

up vote 36 down vote accepted

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
share|improve this answer
    
thanks. it worked – arn-arn Jul 7 at 19:52

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
share|improve this answer
3  
This is worth trying even if you never touched the proxy setting and aren't behind one currently. I think this was somehow set automatically during a past hotel stay (or when using in-flight wifi) where a proxy was in place. – Shawn Erquhart Mar 24 '15 at 16:51
1  
Note that this will only unset the HTTP proxy. If you're having difficulty connecting to HTTPS locations, use the sister command 'git config --global --unset https.proxy' – degs Jul 11 '15 at 5:43
1  
This solved my problem. I was getting an error from homebrew "fatal: unable to access 'github.com/caskroom/homebrew-cask/';: Could not resolve proxy: wpad" and this resolved it. – 609south Jul 31 '15 at 12:45
    
I never touched the proxy settings, didn't change any of my previously working settings, and have never even used a proxy. But this is what worked to fix my problem. Thank you. – SummerEla Sep 11 '15 at 21:05
1  
Thank you so much. Could you please tell me why this problem occurs? – Aman Tandon Mar 25 at 14:13

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

share|improve this answer
    
worked after turning off VPN!! – sravan_kumar Jul 3 '14 at 17:55

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)

share|improve this answer
2  
This worked for me. Thanks – Abhishek Prakash Jan 3 '15 at 17:21
    
Thank you for this :) – Katti Dec 8 at 14:24

Spent a couple hours trying to fix this.

Re-connecting my wifi did the trick.

share|improve this answer
1  
lol, that was the problem at my end too. I had my browser open in another computer (it sucks the life out of my work Mac otherwise). And I was looking for the solution in another PC. Didn't notice that the work computer had got disconnected. – Nitin Nain Jan 28 at 5:56

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.

share|improve this answer

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: How to change a remote repository URI using Git?

share|improve this answer

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...

share|improve this answer
    
I experienced this on a Mac. Restarting my terminal fixed it. – quietquake Nov 16 at 19:05
    
Same here on a debian install. – MikeiLL 2 days ago

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.

share|improve this answer
    
Hi John - Can you provide details as to how you removed the '/' ? I'm having the same issue you describe above. – user1259823 Oct 21 at 18:12

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.

share|improve this answer

This solve the issue

git config --global --unset http.proxy

or https

git config --global --unset https.proxy
share|improve this answer

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....

share|improve this answer

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

share|improve this answer

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.

share|improve this answer

i have same issue and solve it by using this command

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.