azsl1326
azsl1326

Reputation: 1410

Git / Bower Errors: Exit Code # 128 & Failed connect

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

Upvotes: 86

Views: 107805

Answers (24)

alking
alking

Reputation: 1

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)

Upvotes: 0

JohnnyFun
JohnnyFun

Reputation: 4293

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

Upvotes: 0

Vikas Verma
Vikas Verma

Reputation: 94

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)

Upvotes: 0

rentire
rentire

Reputation: 96

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.

Upvotes: 1

Shashank Gupta
Shashank Gupta

Reputation: 1

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 ).

Upvotes: 0

Stenal P Jolly
Stenal P Jolly

Reputation: 777

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

Upvotes: 0

Narayana
Narayana

Reputation: 100

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

Upvotes: 0

Matteo Tosato
Matteo Tosato

Reputation: 235

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!

Upvotes: 0

Dahar Youssef
Dahar Youssef

Reputation: 479

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

Upvotes: 3

ablais
ablais

Reputation: 1426

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.

Upvotes: 125

flailgull
flailgull

Reputation: 1

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.

Upvotes: 0

Ignatius Andrew
Ignatius Andrew

Reputation: 8258

Navigate to your Application Folder and run this command

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

"

This should fix your issue

Upvotes: 5

kaiser
kaiser

Reputation: 22353

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.

Upvotes: 0

user3805793
user3805793

Reputation: 191

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.

Upvotes: 0

avadhesh pareek
avadhesh pareek

Reputation: 1

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.

Upvotes: 0

Steve Neal
Steve Neal

Reputation: 786

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!

Upvotes: 3

Gervase
Gervase

Reputation: 1030

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.

Upvotes: 0

user1228
user1228

Reputation:

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

Upvotes: 0

Frank Fu
Frank Fu

Reputation: 3643

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:[email protected]:8080
git config --global https.proxy https://proxyuser:[email protected]:8080

And making sure it worked

git config --list

Upvotes: 20

TwystO
TwystO

Reputation: 2562

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.

Upvotes: 2

Henry
Henry

Reputation: 7891

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.

Upvotes: 6

azsl1326
azsl1326

Reputation: 1410

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.

Upvotes: 8

antonjs
antonjs

Reputation: 14318

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 [email protected]: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

Upvotes: 34

Kit
Kit

Reputation: 3578

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

Upvotes: 3

Related Questions