Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bower - fatal: unable to connect to github.com

Tags:

github

bower

After upgrading ember-cli on my mac (Yosemite 10.10.2)

npm uninstall -g ember-cli
npm cache clean
bower cache clean
npm install -g [email protected]
....

or maybe after Yosemite upgrade to 10.10.2, or after upgrade my Java to v8-32... my bower doesnt work anymore.

If I try:

bower list

I get an error:

bower check-new Checking for new versions of the project dependencies..
bower ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/rwjblue/ember-cli-test-loader.git", exit code of #128

Additional error details:
fatal: unable to connect to github.com:
github.com[0: 192.30.252.128]: errno=Operation timed out

But if I execute:

git ls-remote --tags --heads git://github.com/rwjblue/ember-cli-test-loader.git

it works:

git ls-remote --tags --heads git://github.com/rwjblue/ember-cli-test-loader.git
c6006a11515c756d115bb5209103a22c2e9554a0 refs/heads/master
929777f8b5c60db3120712c7328f5debdf74a0cd refs/tags/0.0.1
055d50f770ad333e7ead10ecb04605f951e2435b refs/tags/0.0.2
9defa2c59df38dcc334d6c1cc266075c04c2a4f6 refs/tags/0.0.3
a925b8fc428829ea3599e66eb0e6353726426356 refs/tags/0.0.4
c6006a11515c756d115bb5209103a22c2e9554a0 refs/tags/v0.1.0

Also every git clone git:// or http:// works and I can access 192.30.252.128 over http.

Only in combination with bower it doesnt work. With npm I have also no problems.

What Im trying was to uninstall and reinstall bower. But this doesnt solve the problem.

Next try:

.bowerrc

with:

{
   "directory": "bower_components",
   "analytics": false,
   "proxy": "",
   "https-proxy": ""
}

Next try:

.gitconfig

[url "https://"]
    insteadOf = git://

With the result:

Additional error details:
fatal: unable to access 'https://github.com/furf/jquery-ui-touch-punch.git/': Failed to connect to github.com port 443: Operation timed out

Iam also try:

ssh -T [email protected]

to add github.com under known_hosts.

The strange thing is:

ssh -T [email protected]
ssh: connect to host github.com port 22: Operation timed out

Try it again:

ssh -T [email protected]
Hi xxxx! You've successfully authenticated, but GitHub does not provide shell access.

So sometimes it works and sometimes not. A look at https://status.github.com/ shows that everything is fine from github.

But why I get sometimes a timeout? Maybe a DNS Server lag? Every other connections are fine.

Also a ping is looking fine: The badest time was

time=100.173 ms

over minutes and I start parallel the bower install command with same timeout as before.... but the ping was going on and only with 100ms.

Im also exit my firewalls with no result.

I have no proxy configurred.

Any idea?

Update 09/02/2014

Im currently in Hamburg and here, the bower install works fine. So it is not a problem of my system installation.

Update 12/02/2014

After being back at home, it also works without any changes. Strange!

like image 678
Sebastian Avatar asked Feb 06 '15 08:02

Sebastian


3 Answers

From this npm thread: https://github.com/npm/npm/issues/5257#issuecomment-60441477

Try dumping the following into your .gitconfig

[url "https://"]
    insteadOf = git://
[url "https://github.com"]
    insteadOf = [email protected]

Since I'm on a Windows machine, I also had to ensure that c:\users\me\.gitconfig and the one on my modified home drive h:\.gitconfig were the same.

like image 51
jpvantuyl Avatar answered Dec 10 '22 09:12

jpvantuyl


Run

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

saves lot of pain specially if one is behind the firewall.

like image 44
Vic Avatar answered Dec 10 '22 09:12

Vic


One Solution for Requiring Modules

This solution has not been tested against bower list, however, (like in my situation) you may be impeded to bower installs due to local, environmental policies. Here's what allowed me to leverage Bower -- saving me from a multitude of headaches:

...
"dependencies": {
    "angular": "https://code.angularjs.org/1.3.15/angular.js",
    "jquery": "https://github.com/jquery/jquery.git#~2.1.4",
    "moment": "https://github.com/moment/moment.git",
    "underscore": "https://github.com/jashkenas/underscore.git#~1.8.3"
}
...

OR,

bower install https://domain.ext/path/to/asset.ext -S

You may be getting the error, fatal: unable to connect to github.com: while trying to install -- this is because in some environments bower cannot resolve the git:// protocol. However, it will resolve http(s):.

My suggestion:

  • Search Bower for a package,
  • Navigate to the git repository,
  • Copy the https git clone URI,
  • bower install https://.../author/module.git --save

This will save (--save / -S) the package to your bower.json file with the #~n.n.n notation for the package-version.

Hope this helps you guys as it did I.

like image 38
Cody Avatar answered Dec 10 '22 09:12

Cody