bower - 致命:无法连接到github.com

时间:2015-02-06 08:57:14

标签: github bower

在我的mac(Yosemite 10.10.2)上升级ember-cli之后

npm uninstall -g ember-cli
npm cache clean
bower cache clean
npm install -g ember-cli@0.1.12
....

或者也许在优胜美地升级到10.10.2之后, 或者将我的Java升级到v8-32之后...... 我的凉亭不再工作了。

如果我尝试:

bower list

我收到错误:

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

但如果我执行:

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

它有效:

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

此外,每个git clone git://或http://都有效,我可以通过http访问192.30.252.128。

只有与凉亭结合才行不通。 有了npm,我也没有问题。

我尝试的是卸载并重新安装凉亭。但这并没有解决问题。

接下来尝试:

.bowerrc

使用:

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

接下来尝试:

.gitconfig

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

结果:

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

我也试试:

ssh -T git@github.com

在known_hosts下添加github.com。

奇怪的是:

ssh -T git@github.com
ssh: connect to host github.com port 22: Operation timed out

再试一次:

ssh -T git@github.com
Hi xxxx! You've successfully authenticated, but GitHub does not provide shell access.

所以有时候它有效,有时候不行。看看https://status.github.com/ 表明github的一切都很好。

但为什么我有时会超时呢? 也许DNS服务器滞后?其他所有的联系都很好。

ping也很好看: 最时间是

time=100.173 ms

超过几分钟,我开始并行bower安装命令与之前相同的超时....但ping正在进行,只有100ms。

我也退出了我的防火墙而没有结果。

我没有代理配置。

有什么想法吗?

2014年2月2日更新

我目前在汉堡,在这里,凉亭安装工作正常。所以这不是我的系统安装问题。

2014年12月2日更新

回到家后,它也没有任何变化。 奇怪!

3 个答案:

答案 0 :(得分:8)

从这个npm主题:https://github.com/npm/npm/issues/5257#issuecomment-60441477

尝试将以下内容转储到.gitconfig

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

由于我使用的是Windows计算机,因此我还必须确保c:\users\me\.gitconfig和我修改后的主驱动器h:\.gitconfig上的那个是相同的。

答案 1 :(得分:4)

需要模块的一种解决方案

此解决方案尚未针对bower list进行测试,但是,(在我的情况下),由于当地的环境政策,您可能会受到bower install的阻碍。这就是让我能够利用Bower的原因 - 让我从众多令人头痛的事情中解脱出来:

...
"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

您在尝试安装时可能会收到错误fatal: unable to connect to github.com: - 这是因为某些环境中的无法解析git://协议。但是,它会解析http(s):

我的建议:

  • 搜索Bower获取包裹,
  • 导航到git存储库
  • 复制 https git clone URI
  • bower install https://.../author/module.git --save

这将保存--save / -S)包发送到您的bower.json文件,其中包含#~n.n.n包版本的表示法。

希望这可以帮助你们,就像我一样。

答案 2 :(得分:3)

运行

git config --global url."https://".insteadOf git://
如果一个人在防火墙后面,

可以节省很多痛苦。