86

I am using Bower to install several libraries. For demonstration purposes here, I am installing bootstrap. Regardless of the package, I receive the following errors:

C:\Scott>bower install bootstrap
bower not-cached    git://github.com/twbs/bootstrap.git#*
bower resolve       git://github.com/twbs/bootstrap.git#*
bower ECMDERR       Failed to execute "git ls-remote --tags --heads git://github
.com/twbs/bootstrap.git", exit code of #128

Additional error details:
fatal: unable to access 'https://github.com/twbs/bootstrap.git/': Failed connect
to github.com:443; No error    

I have tried using the following solution to remove the first error - which I found from this search:

git config --global url."https://".insteadOf git://

However, this does not work nor do any of the other solutions found on that page. Searching for a solution for the 2nd error, it seems that setting a username/pwd for a proxy server will resolve the issue if you are on a corporate network/behind a firewall. However, I am not using a proxy server as I am on my home pc/network (windows 7 x64).

Thanks!

EDIT: Command window with errors:

enter image description here

azsl1326
  • 1,400
  • 2
  • 12
  • 22
  • Possible duplicate of [Bower install using only https?](https://stackoverflow.com/questions/15669091/bower-install-using-only-https) – kenorb Jan 23 '18 at 15:43
  • had a similar problem with `npm` and https, solved with `git config --global url."git@github.com:".insteadOf "https://github.com"` – grabantot Oct 02 '18 at 13:32

24 Answers24

123

I know this is not "fixing" the problem, but you can use

git config --global url."https://".insteadOf git://

to tell git to use HTTPS instead of GIT which worked out for me to install npm dependencies.

isherwood
  • 46,000
  • 15
  • 100
  • 132
ablais
  • 1,406
  • 1
  • 10
  • 12
  • 10
    Is it just me, or does this not actually work for anyone else? This is the highest result on google for practically all searches pertaining to bower 128 errors, and after changing this setting bower still uses the git protocol. – Bloodyaugust Aug 19 '14 at 22:03
  • 1
    @Bloodyaugust, it doesn't work for me either. Still uses `git://` – Logan Sep 03 '14 at 16:39
  • 1
    This did work for me, though I'm unclear as to what the problem was. – Mendhak Sep 08 '14 at 07:05
  • Also worked for me, and I also don't know why. @Bloodyaugust, @Logan, have you checked your global .gitconfig file (`git config --global --edit`)? Just, you know, to make sure. And some more specific .gitconfig (per user, or per git project) could be overriding it. – Rafael Eyng Sep 09 '14 at 19:24
  • @RafaelEyng Yes, it would seem the rules are created... just not functional. :/ – Bloodyaugust Sep 11 '14 at 22:40
  • 2
    Worked for me - I'm guessing port 22 is closed on work machine where I was trying this. So no SSH to github :( I can say that I did run the command from the (git) project folder...if that makes any diff. – demaniak Oct 21 '14 at 16:03
  • This doesn't work for me either, the only way I've been able to get packages is by letting the request fail, manually editing the URL in the newly created file in "..\bower\cache\registry\bower.herokuapp.com\lookup\" and trying again – Tom Tregenna Nov 26 '14 at 13:58
  • Even my error got resolved. I was getting the error while installing Polymer >> bower polymer#* ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/Polymer/polymer.git", exit code of #128 fatal: unable to connect to github.com: github.com[0: <>]: errno=No error – Ganesh Kamath - 'Code Frenzy' Apr 03 '16 at 11:36
34

Instead to run this command:

 git ls-remote --tags --heads git://github.com/twbs/bootstrap.git

you should run this command:

 git ls-remote --tags --heads git@github.com:twbs/bootstrap.git

or

 git ls-remote --tags --heads https://github.com/twbs/bootstrap.git

or you can run git ls-remote --tags --heads git://github.com/twbs/bootstrap.git but you need to make git always use https in this way:

 git config --global url."https://".insteadOf git://

Reference: https://github.com/bower/bower/issues/50

antonjs
  • 13,120
  • 11
  • 61
  • 86
  • Thanks. I attempted to force git to always use https but not sure it worked -- see image I attached in original post. Errors are still occurring no matter which bower install package I try. – azsl1326 Feb 07 '14 at 01:14
20

I came across this with my corporate network.

It seemed strange because I've always been using ssh to connect with git and never had an issue.

I tried https and didn't work so I added proxy settings to git's config and all was well

git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080
git config --global https.proxy https://proxyuser:proxypwd@proxy.server.com:8080

And making sure it worked

git config --list
Frank Fu
  • 2,842
  • 2
  • 24
  • 34
  • Thanks... This was my case as well. I had to configure git to use the co. proxy.. – Paul T. Jan 21 '15 at 21:20
  • If this worked for you and you're using npm also, you'll probably need to set the equivalent: `npm config set proxy http://` and `npm config set https-proxy http://` – aponzani Jul 02 '15 at 18:57
  • 1
    `git config http.sslVerify "false"` might be needed for some corporate proxies too. – John Fouhy Dec 23 '15 at 02:22
8

Port 22 was being blocked on my computer. Once I found what was blocking it and opened the port, I was able to run the bower install cmd without any issues.

azsl1326
  • 1,400
  • 2
  • 12
  • 22
6

It appears as though azsl1326 failed to use bower (git) over port 9418 (git://), then told git to use port 22 (https://) instead. This was still failing, but then opening port 22 got the desired result.

The most direct solution is to open port 9418. This is the port that the git:// protocol uses.

Henry
  • 6,843
  • 2
  • 32
  • 35
5

Navigate to your Application Folder and run this command

git config --global url."https://".insteadOf "git://

"

This should fix your issue

Ignatius Andrew
  • 6,788
  • 2
  • 43
  • 48
3

Perhaps you need to generate an ssh key so you are authenticated with github.

Kit
  • 3,038
  • 1
  • 24
  • 23
3

Are you behind a firewall?

Git doesn't pick up the proxy configuration when it's called, so set environment variables explicitly, e.g.:

export HTTP_PROXY=http://username:password@proxyserver:port/
export HTTPS_PROXY=http://username:password@proxyserver:port/

If your corporate proxy doesn't need authentication just omit the username:password@ bit in the URLs.

It worked for me!

Steve Neal
  • 705
  • 3
  • 7
  • 16
3

If your country block github, e.g. China mainland, then you can build a proxy, e.g. use goagent & gae, then set proxy address for git, e.g.

git config --global http.proxy 127.0.0.1:8087
Dahar Youssef
  • 361
  • 2
  • 8
2

This error is related to a bad configuration of your firewall. You will notice that bower trying to contact git via the git:// protocol and not http://. You have to open port 9418. Add this two lines in your iptables configuration :

iptables -t filter -A INPUT -p tcp --dport 9418 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp --dport 9418 -j ACCEPT

This should do the trick.

TwystO
  • 2,152
  • 1
  • 19
  • 24
1

Firstly, you should check if Visual Studio Command prompt recognizes git command: Tools > Command Line

C:\....\> git

if this command is not recognized, you should add git folder into Environment Variables

https://stackoverflow.com/a/26620861/3449657

This is what I was missing and did the trick for me.

Hope it helps.

Community
  • 1
  • 1
rentire
  • 96
  • 10
0

Am adding my answer here as this is one of the closest questions that matched my situation. Was trying to install select2 rather than bootstrap, but the outcome was the same.

bower install select2 reported that git was unable to locate the directory. Used the

git config --global url."https://".insteadOf git://

config fix, but that resulted in a (paraphrased) error

I can't use https

My issue was resolved unsatisfactorily, as it involves magic.

I was attempting to run this in a command shell (cmd.exe, windows). I ran the same command and ran it in powershell and it worked. ಠ_ಠ

tl;dr: combination of https:// and powershell worked for me

0

I got this error after my virus checker had quarantined a download from github.com. For some unknown reason.

After I cleared those files (exe files) everything worked.

Gervase
  • 930
  • 8
  • 15
0
git config --global url. "https://".insteadOf "git://"  

was not working for me. So I found this alternative:

Go to your temp folder. ( i.e. if you are using windows then C:\Users\{username}\AppData\Roaming\bower\cache\packages ). There you can see several files. Open each of them and you can see the URL. Change it from git://... to https://... and save all files.

Now run the bower install.

Mansuro
  • 4,194
  • 4
  • 31
  • 72
0

Check your git config settings (git config --global --edit). In my case there were a couple of no longer valid entries like:

[core]
gitproxy=gitproxy.cmd
["https://"]
["https://"]
[url "https://"]

Revise them and remove if you don't need them anymore.

user3805793
  • 71
  • 1
  • 2
0

Your keys are wrong. Just add them to GitHub/Bitbucket/whatever you are using. It's nothing more than a permission issue with your keys.

kaiser
  • 19,898
  • 15
  • 82
  • 102
0

However, I am not using a proxy server as I am on my home pc/network

Had the same problem (getting exit code 128) on my home network and was quite sure i was not using a proxy. Turns out, Git had saved a proxy i had entered some time in the past - after looking around in the configs, i found it under the [http] tag.

I'm new to Git, and i'm not at all sure, if those configs are usually easily accessible - am using Tortoise Git, since i'm not doing anything fancy really and that has a GUI for the things.

Hope the "answer" helps nonetheless.

0

In my case was the folder access where i was during the command execution! On windows I created the folder first by command line: mkdir "MyFolder" and I had the error. but if I create the folder with the mouse, right click, create folder etc. Works fine!

Matteo Tosato
  • 165
  • 2
  • 14
0

If you are authenticating with bitbucket, where I'm getting error 128 & Failed connect. but when using authenticating git hub its working fine.

Narayana
  • 56
  • 7
0

I know this is an old question, anyway let me add one more thing.

Sometimes(If you are in an office or private network) your gateway server firewall block the https requests(port 443) from the command terminal

git config --global url."http://".insteadOf "https://"

Use this to config the git to use http over https for those situvations

Stenal P Jolly
  • 491
  • 4
  • 15
0

This worked for me,

Copy the file "libcurl.dll" in Git installation folder ( C:\Program Files\Git\bin\libcurl.dll ). Paste it in location where the git.exe exists ( C:\Program Files\Git\libexec\git-core ).

0

Run these 2 commands to grant git access via your system

eval `ssh-agent`
ssh-add ~/.ssh/id_rsa

These commands are assuming that you have ssh key over the remote git server(bitbucket/github/other)

Fruchtzwerg
  • 8,750
  • 12
  • 37
  • 44
0

I ran into this error too, and resolved by updating git. When I ran the failed git ls-remote command, the underlying error was that an old tls version was being used. So updated version of git uses later version of tls.

https://git-scm.com/download/win

JohnnyFun
  • 3,068
  • 2
  • 15
  • 15
0

i found this error on my linux os. and i solve this problem 1. open curl log export GIT_CURL_VERBOSE=1 2.clone git repo 3. find the log 4. i fix the problem by update nss and curl (yum update nss nss-util nspr curl)

alking
  • 1