I am using Visual Studio (2015) as my development environment and are moving along with the “new trend” using bower, npm, gulp, etc for front-end (package) management. I did really like the integrated way of doing stuff in Web Essentials, but I am slowly learning the new ways… I have come across some difficulties when sitting behind customer firewalls, though…
So when you add a package to your bower.json and save, Visual Studio will install the modules using bower.cmd. git:// being blocked by the firewall yields something like this in the output window
bower angular#1.40.60 ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/angular/bower-angular.git", exit code of #-532462766
The git used by bower.cmd in Visual Studio is using its own git based on LibGit2Sharp.dll from Team Explorer. This is “easy”, but it does not support the full set of “normal” git commands, like changing protocol.
If you haven’t done so, go off to http://git-scm.com/downloads and grab git for windows – default options should work just fine.
Configure git to use https
Next step is quite simple, just open your favourite command-line tool and run the following command
git config --global url."https://".insteadOf git://
Now git will switch to https:// whenever it encounters git://
Configure Visual Studio to use the new git
Now we need to swap the git used by Visual Studio. There are 2 obvious ways of doing this:
1- Edit bower.cmd
Bower.cmd can be found in C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\Bower.cmd. Open it in an editor and change the script to use your newly installed git for windows.
2- My preferred option; Change the tooling in Visual Studio
Head to Tools-> Options->Projects and Solutions –> External Web Tools
Uncheck the standard git-command and add a new entry for git like shown in the picture.
* happy coding *