203

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
wjandrea
  • 28,235
  • 9
  • 60
  • 81
Mohamed Hussain
  • 7,433
  • 14
  • 55
  • 85

5 Answers5

382

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
Chronial
  • 66,706
  • 14
  • 93
  • 99
  • 4
    thanks it helped me too. I just updated url line inside .git > config ==> to https ://git@git...xxx – STEEL May 29 '14 at 09:21
  • worked for me but had to disable 2 factor auth when cloning from private organization repo – random-forest-cat Sep 26 '14 at 22:45
  • 8
    Any advice on what to do if HTTPS is getting timed out as well? – gjw80 Dec 12 '14 at 14:30
  • @STEEL 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. – gotnull Apr 28 '16 at 04:33
  • Unfortunately this won't work if a dependency has dependencies with "angular/angular-phonecat". – sclausen Jul 15 '16 at 06:44
  • Thanks https:// works for me looks like my system firewall blocks git:// scheme – Amit Singh Jul 04 '22 at 09:39
  • 1
    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://** – Sathnindu Kottage Aug 04 '22 at 10:14
  • @gjw80 had a point in one of the above comments. Below answer https://stackoverflow.com/a/31044011/3625752. Will be helpful in setting up the proxy of the company into git config and then try with git clone will work – rinilnath Mar 21 '23 at 16:11
364

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?

Community
  • 1
  • 1
bnguyen82
  • 6,048
  • 5
  • 30
  • 39
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
rneha725
  • 475
  • 4
  • 12
16

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.

Chris Halcrow
  • 28,994
  • 18
  • 176
  • 206
  • 2
    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. – thurt Mar 28 '18 at 17:52
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.

bad_coder
  • 11,289
  • 20
  • 44
  • 72