A fix for Bower failure because firewall blocks git:// protocol — error #128

I recently discovered that Bower was failing to install components of an Angular project because the public library wifi that I was using blocked the port that GIT uses to grab things using its git:// protocol. The following error occurs for the first attempted GITHUB download:

ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/jquery/jquery.git", exit code of #128 fatal: unable to connect to github.com: github.com[0: 192.30.252.128]: errno=No error

One way to fix that is to change to https://. But many people do not want to reconfigure their GIT profile and then have to change it back.

This should work for you if you do not want to alter your personal profile’s GIT configuration. It configures only your project directory.

If you are already working in a GIT configured project directory, you already have a “.git” folder and “config” file. If you have no “.git” folder and “config” file, create a “.git” folder with a “config” file in it.

--project (folder)
    --.git (subfolder)
        --config (file)

Run the following LOCAL GIT configuration command (do NOT use “–global” which will change your profile configuration) while in your project folder as the current working directory:

[project folder] $ git config url."http://".insteadOf git://

That should enter the following into your “.git/config” file:

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

You can also just type that into the “config” file. Those lines change the protocol from git:// to https://.

Place your already configured “bower.json” file in your project directory and run:

$ bower install

On the other hand, if you are creating a bower configuration file rather than using an already configured one, run

$ bower init

Answer the questions. That will create a bower.json file for you. Then run:

$ bower install thingamajig --save

Advertisements