Unable to Connect to GitHub.com For Cloning

194,614

Solution 1

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

Solution 2

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?

Solution 3

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

Solution 4

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.

Share:
194,614

Related videos on Youtube

Mohamed Hussain
Author by

Mohamed Hussain

Senior Front End Developer, creating fast loading high performance RWD Web Pages, Learning and sharing what I learned. Love to avoid costly heavy frameworks and using vanilla JS , HTML, CSS alternatives when possible. Good in vanilla JS, CSS, HTML, PWA Features, jQuery, Angular 1.x , CSS frameworks Foundation, bootstrap.

Updated on September 01, 2021

Comments

  • Mohamed Hussain
    Mohamed Hussain over 2 years

    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
    
    • laurent
      laurent about 11 years
      What does ping github.com gives you?
    • Mohamed Hussain
      Mohamed Hussain about 11 years
      @Laurent This is the one i got:Pinging github.com [204.232.175.90] with 32 bytes of data:
    • Mohamed Hussain
      Mohamed Hussain about 11 years
      @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),
    • Chronial
      Chronial about 11 years
      Are you behind a firewall?
    • Chronial
      Chronial about 11 years
      Try this command: git clone https://github.com/angular/angular-phonecat.git (using https)
    • Mohamed Hussain
      Mohamed Hussain about 11 years
      @Chronical yes i guess.. how to know i am behind the firewall. Please help me to find this.
    • Mohamed Hussain
      Mohamed Hussain about 11 years
      @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.
    • Vahap Gencdal
      Vahap Gencdal about 8 years
    • Vahap Gencdal
      Vahap Gencdal about 8 years
    • zypro
      zypro about 4 years
      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.
  • Achyut
    Achyut about 10 years
    Can you share something similar for Windows
  • STEEL
    STEEL almost 10 years
    thanks it helped me too. I just updated url line inside .git > config ==> to https ://[email protected]
  • STEEL
    STEEL almost 10 years
    thanks man. i was also hving same issue while work from office internet. which doesnt allow SSH url.
  • lfender6445
    lfender6445 over 9 years
    worked for me but had to disable 2 factor auth when cloning from private organization repo
  • gjw80
    gjw80 over 9 years
    Any advice on what to do if HTTPS is getting timed out as well?
  • androidevil
    androidevil over 9 years
    your answer is the same as Chronial, that is the answer checked as right for this question.
  • Gavin
    Gavin over 8 years
    Is there a way to make this work only for domain github.com?
  • fulvio
    fulvio about 8 years
    @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.
  • sclausen
    sclausen almost 8 years
    Unfortunately this won't work if a dependency has dependencies with "angular/angular-phonecat".
  • Javier Abrego
    Javier Abrego about 7 years
    git config --global url."https://github.com".insteadOf git://github.com
  • KansaiRobot
    KansaiRobot over 6 years
    what proxy_username??
  • thurt
    thurt about 6 years
    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.
  • Louis 'LYRO' Dupont
    Louis 'LYRO' Dupont about 5 years
    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:port
  • zappy
    zappy about 5 years
    i would mark this as the perfect answer, for those are using repo/yocto way
  • GDP2
    GDP2 over 4 years
    This can also be undone in ~/.gitconfig if you only want to apply it temporarily.
  • Prometheus
    Prometheus over 4 years
    The below commands also work for me. git config --global http.proxy proxy_ip:port git config --global https.proxy proxy_ip:port
  • Amit Singh
    Amit Singh almost 2 years
    Thanks https:// works for me looks like my system firewall blocks git:// scheme