问题
在 Visual Studio 2015 中,使用 Bower,我的包在防火墙后恢复失败,错误类似于:
ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/jzaefferer/jquery-validation.git", exit code of #-532462766
我已经更新了我的 git 配置以使用 http
而不是 git。当我从命令行运行时,命令成功:
但是无论如何,Visual Studio 或其组件之一似乎都在使用 git
而不是 http
。
背景和第一次尝试解决
使用 Visual Studio 2015 和 Bower 进行包管理。不在防火墙后面时效果很好,但在防火墙后面时我无法使用 git://
协议(protocol)。
解决方案——记录在 SO (example) 的许多其他地方,是运行:
git config --global url."http://".insteadOf git://
我这样做了,现在我的 git config -l
看起来像:
ore.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
user.name=Sean Killeen
user.email=SeanKilleen@gmail.com
url.http://.insteadof=git://
但尽管如此,要么 Visual Studio/npm 不遵守我的配置,要么正在使用它的旧缓存版本。
第二次尝试解决
根据 this thread on npm issue ,我看到 npm(大概是 bower 在 VS 中使用的)使用 git@
语法。尽管这不是我在输出中看到的,但我还是想试一试。
我跑了:
git config --global url."https://github.com/".insteadOf git@github.com:
然后我重新启动了 Visual Studio,但问题仍然存在。我读到的修复可能永远不适用。
关于如何修复的任何想法?
最佳答案
同样的问题使用 VS 2015,我的解决方法:
安装 Git
将 Git 配置为在 Git Bash 中使用 http 而不是 git://
git config --global url."http://".insteadOf git://
编辑(如 g.pickardou 所指)您可以使用 https 来提高安全性:
git config --global url."https://".insteadOf git://
配置 VS 以在 VS Git 上使用新安装的 Git
右键单击 Bower 文件夹(在 Dependencies 下),然后选择“配置外部工具”
取消选中“$(DevEnvDir)\Extensions\Microsoft\Web Tools\External\git”
使用“C:\Program Files (x86)\Git\bin”添加一个新节点
希望这对某人有帮助,
罗杰里奥
关于git - VS 2015 + bower : Does not work behind firewall,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28725727/