简体   繁体   中英

On Gitbash - Bower : ENOGIT git is not installed or not in the PATH

I have a project with bower.json file and im trying to load all it's bower libraries on Windows. I turn on Gitbash, cd to that project directory and type in bower install / bower update. I receive an error:

bower ENOGIT        git is not installed or not in the PATH

But there is a path to git:

$ which git
/bin/git

So the wierd thing that it actually works in cmd on Windows, but it doesnt work with Gitbash . This is the value i have in the system PATH env variable regarding git:

C:\Program Files (x86)\Develop\VCS\Git\cmd

I tried to re-install msysgit and chose the option: Run Git From Windows Command Prompt like so:

在此输入图像描述

It still doesnt seem to work..

Bower version:

$ bower --version
1.4.1

Git version:

$ git --version
git version 1.9.5.msysgit.1
  • Bower is installed globally using npm

EDIT: I found the cause of this issue: I have a file in my profile home directory .bashrc that i usually use in order to define general aliases and so on and i added this line:

export PATH="~/AppData/Roaming/Composer/vendor/bin":$PATH

And somehow when this line is present i receive the error in Gitbash, wierd though, it just add the path to global composer packages, what it has to do with git itself or bower?

Check this solution posted by saurabhkohli in this GitHub issue :

[U]pdating the PATH environment variable with the current installed location of the GIT in your system will help resolve this issue, or you can update the same in your NodeJS command prompt by using "set PATH=%PATH%;C:\\Program Files\\Git\\bin;"

I just hit the same issue when trying to use windows command line. Turns out, you have to select this setting twice and I have missed the second one.

Here's a few screenshots if any help for anyone:

一世

The one I have missed: Ĵ

After reinstalling with the above settings, everything seem to be ok.

Try to unzip a portable Git in a simpler path (no space).
Take the latest one from git for Windows: PortableGit-2.4.5.1-4th-release-candidate-64-bit.7z.exe .
(no setup required, just an auto-extractable archive here)

Remove from your PATH the old msysgit, and add C:\\path\\to\\PortableGit-2.4.5.1-4th-release-candidate-64-bit\\bin to the %PATH% .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM