Unable to Connect to GitHub.com For Cloning
Asked Answered
S

5

210

I am trying to clone the angular-phonecat git repository, but I am getting the following message when I enter the command in my Git Bash:

$ git clone git://github.com/angular/angular-phonecat.git  
Cloning into 'angular-phonecat'...  
fatal: unable to connect to github.com:  
github.com[0: 204.232.175.90]: errno=No error
Sural answered 30/4, 2013 at 11:39 Comment(0)
A
392

You are probably behind a firewall. Try cloning via https – that has a higher chance of not being blocked:

git clone https://github.com/angular/angular-phonecat.git
Atahualpa answered 30/4, 2013 at 14:9 Comment(8)
thanks it helped me too. I just updated url line inside .git > config ==> to https ://[email protected]Though
worked for me but had to disable 2 factor auth when cloning from private organization repoWellheeled
Any advice on what to do if HTTPS is getting timed out as well?Yod
@Though Thanks for pointing me in the right direction. I had tried all of those insteadOf commands multiple times with different options and noticed that my ~/.git_config was messed up. I removed all of them, disabled my Mac OSX Firewall and now everything works.Tango
Unfortunately this won't work if a dependency has dependencies with "angular/angular-phonecat".Aubine
Thanks https:// works for me looks like my system firewall blocks git:// schemeTorero
If the issue occurred during either npm or yarn install, change the default requesting protocol from git:// to https:// by running, git config --global url."https://".insteadOf git:// Also, you can revert this change later by running, git config --global url."git://".insteadOf https://Yahairayahata
@Yod had a point in one of the above comments. Below answer https://mcmap.net/q/126142/-unable-to-connect-to-github-com-for-cloning. Will be helpful in setting up the proxy of the company into git config and then try with git clone will workSubacid
B
378

You can make git replace the protocol for you

git config --global url."https://".insteadOf git://

See more at SO Bower install using only https?

Burst answered 19/9, 2013 at 7:56 Comment(5)
thanks man. i was also hving same issue while work from office internet. which doesnt allow SSH url.Though
Is there a way to make this work only for domain github.com?Sevigny
git config --global url."https://github.com".insteadOf git://github.comMatias
i would mark this as the perfect answer, for those are using repo/yocto wayFascine
This can also be undone in ~/.gitconfig if you only want to apply it temporarily.Christoforo
I
31

I had the same error because I was using proxy. As the answer is given but in case you are using proxy then please set your proxy first using these commands:

git config --global http.proxy http://proxy_username:proxy_password@proxy_ip:port
git config --global https.proxy https://proxy_username:proxy_password@proxy_ip:port
Isotope answered 25/6, 2015 at 7:35 Comment(3)
what proxy_username??Comitia
To use the default proxy credentials, use the following commands: git config --global http.proxy http://:@proxy_ip:port and git config --global https.proxy https://:@proxy_ip:portRoofdeck
The below commands also work for me. git config --global http.proxy proxy_ip:port git config --global https.proxy proxy_ip:portUndersurface
A
17

Open port 9418 on your firewall - it's a custom port that Git uses to communicate on and it's often not open on a corporate or private firewall.

Abdullah answered 22/10, 2015 at 0:7 Comment(1)
if you are already using https:// and still having issues, try this answer. i just had to add a 9418 port trigger on my router and it worked.Inconsistent
S
0

I was having this problem but just realized that GitHub must be one of the sites my ISP's "child safe" filter blocks by default. Presumably there are some, er, adult code repositories out there. I added github.com to the Allow List on my ISP account page and all is working now. Might be worth checking if you have a similar filter in place.

Sapphism answered 31/8, 2021 at 18:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.