git:// protocol (tcp 9418) blocked by firewall

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…

The error

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.

Install git

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

image

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 *

Advertisements

About skattefuten

Check my about page :-)
This entry was posted in Visual Studio and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s