174

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
  • 23,210
  • 7
  • 49
  • 68
Mohamed Hussain
  • 6,911
  • 14
  • 49
  • 83
  • 3
    What does `ping github.com` gives you? – laurent Apr 30 '13 at 11:42
  • @Laurent This is the one i got:Pinging github.com [204.232.175.90] with 32 bytes of data: – Mohamed Hussain Apr 30 '13 at 12:32
  • @Laurent Pinging github.com [204.232.175.90] with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. Ping statistics for 204.232.175.90: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), – Mohamed Hussain Apr 30 '13 at 13:15
  • Are you behind a firewall? – Chronial Apr 30 '13 at 13:19
  • 14
    Try this command: `git clone https://github.com/angular/angular-phonecat.git` (using https) – Chronial Apr 30 '13 at 13:20
  • @Chronical yes i guess.. how to know i am behind the firewall. Please help me to find this. – Mohamed Hussain Apr 30 '13 at 13:49
  • @Chronial After using the https:// as u suggested i am able to clone the repository. thanks a lot. You saved my day. put the answer in answer's section. – Mohamed Hussain Apr 30 '13 at 13:55
  • You can find answer from this post http://stackoverflow.com/questions/21789683/how-to-fix-bower-ecmderr – Vahap Gencdal Mar 17 '16 at 08:49
  • you can find answer from this post http://stackoverflow.com/questions/21789683/how-to-fix-bower-ecmderr – Vahap Gencdal Mar 17 '16 at 08:50
  • I'm facing this issue only sometimes but from different servers im cloning on. Sometimes a rerun works, sometimes I have to try it multiple times... So in the same time 2 Server can clone the repo while another can't. – zypro Feb 20 '20 at 08:36

6 Answers6

329

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
  • 60,064
  • 13
  • 82
  • 88
  • 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 – lfender6445 Sep 26 '14 at 22:45
  • 7
    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. – fulvio 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
300

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
  • 5,388
  • 5
  • 29
  • 38
30

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
  • 457
  • 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
  • 25,566
  • 14
  • 148
  • 174
  • 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
  • 8,684
  • 19
  • 37
  • 59
-4

You can try to clone using the HTTPS protocol. Terminal command:

git clone https://github.com/RestKit/RestKit.git
Alessandro Vendruscolo
  • 13,829
  • 4
  • 30
  • 40
Deepak Sasindran
  • 500
  • 6
  • 13