VS 2015 + Bower: Does not work behind firewall
Problem
In Visual Studio 2015, using bower, my package restores fail when behind a firewall with an error similar to:
ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/jzaefferer/jquery-validation.git", exit code of #-532462766
I have updated my git config to use http
instead of git. When I run from my command line, the command is successful:
But Visual Studio or one of its components appears to be using git
instead of http
regardless.
Background & First Attempt to Resolve
Using Visual Studio 2015 and Bower for package management. It works great when not behind a firewall, but when behind a firewall I cannot use the git://
protocol.
The solution -- documented in many other places on SO (example), is to run:
git config --global url."http://".insteadOf git://
I did this, and now my git config -l
looks like:
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
[email protected]
url.http://.insteadof=git://
But despite this, either Visual Studio / npm is not respecting my configuration, or is using an old, cached version of it.
Second Attempt to Resolve
Per this thread on npm issue, I saw that npm (which presumably bower is using in VS) uses the git@
syntax. Even though this isn't what I saw in the output, I figured I'd give it a shot.
I ran:
git config --global url."https://github.com/".insteadOf [email protected]:
I then restarted Visual Studio, but the issue still persists. The fix I'd read about was likely never applicable.
Any ideas on how to fix?
Solution 1:
Same problem using VS 2015, my workaround :
-
Install Git
http://git-scm.com/
-
Configure Git to use http instead of git:// with Git Bash
git config --global url."http://".insteadOf git://
Edit (as pointed by g.pickardou) you can use https to be more secure:
git config --global url."https://".insteadOf git://
-
Configure VS to use the new installed Git over VS Git
Right click on Bower folder (under Dependencies), then select "Configure external tools"
Uncheck "$(DevEnvDir)\Extensions\Microsoft\Web Tools\External\git"
Add a new node with "C:\Program Files (x86)\Git\bin"
Hope this will help someone,
Rogerio
Solution 2:
Microsoft's version of git that is installed (at least with VS2015 Update 1) does honor the .gitconfig file, but the tooling that is installed by default does not give you a way to manipulate it (like all the other answers show using git config to fix the problem).
To fix the problem without any extra installations and whatnot, simply create a .gitconfig file in C:\Users\YourUserName and put this content in there (which is the content that git config --global would do but since you dont have a git.exe that can change config, you cannot use that without installing something else you do not really need)
[url "https://github.com/"] insteadOf = [email protected]: [url "https://"] insteadOf = git://