236

Git is installed and is in the path.

Platform: Red Hat Enterprise Linux 5.8.

>which git
/usr/local/bin/git

Yet bower can't find it:

bower angular#1.0.6  ENOGIT git is not installed or not in the PATH

What is the recommended work-around?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
user3112929
  • 2,411
  • 2
  • 12
  • 5
  • 1
    This boiled down to a problem with node-which. If a file is in the path but has suid/sguid set, node-which will not 'see' it. In my case, git was in the path, and unix which found it. the pemissions were set like this: -rwxrwsr-- 1 root mygroup. When I ran chmod 755 git. which.sync('git') found it. – user3112929 Dec 19 '13 at 02:30
  • This issue is also applicable to windows 7 and so are the solutions e.g http://stackoverflow.com/questions/20666989/bower-enogit-git-is-not-installed-or-not-in-the-path/21444065#21444065 solution works – Ram Dec 12 '15 at 15:16
  • @PeterMortensen You linked the wrong OS. "Red Hat Linux" is an obsolete product from 20 years ago. "Red Hat **Enterprise** Linux" is the name of the thing being used in this century. – nobody Dec 17 '15 at 12:57
  • I ran into this on Ubuntu 15.10, and I fixed it "perhaps" by installing git and then AFTER git is installed, fully un-install and then re-install npm, and then proceed with all install steps following the "install npm" step, and it seemed to work, although too two runs(attempts at same command) to succeed, if a recall. There must be some reconfigure all command for npm or something what would allow it to rebuild locations of git, etc. BTW: The place this halted my forward progress was trying to install the Polymer/polymer package. –  Dec 21 '15 at 19:01
  • 1
    Why we can't just install Git with bower then ? – Hassam Abdelillah Apr 10 '16 at 22:06
  • I had this problem in Windows 10 because my %GIT_HOME% variable had quotes in it: `GIT_HOME="C:\Program Files\Git"`. Changing it to `GIT_HOME=C:\Program Files\Git` fixed the issue. – Charles Wood May 16 '16 at 21:33
  • I do not need git. I just need to do this > `bower install --save bootstrap-css`. But it needs git. What a mess. – Partha Sarathi Ghosh Jul 26 '16 at 06:46

18 Answers18

340

Adding Git to Windows 7/8/8.1 Path

Note: You must have msysgit installed on your machine. Also, the path to my Git installation is "C:\Program Files (x86)\Git". Yours might be different. Please check where yours is before continuing.

Open the Windows Environment Variables/Path Window.

  1. Right-click on My Computer -> Properties
  2. Click Advanced System Settings link from the left side column
  3. Click Environment Variables in the bottom of the window
  4. Then under System Variables look for the path variable and click edit
  5. Add the pwd to Git's binary and cmd at the end of the string like this:

    ;%PROGRAMFILES(x86)%\Git\bin;%PROGRAMFILES(x86)%\Git\cmd
    

Now test it out in PowerShell. Type git and see if it recognizes the command.

This is image showing you how to do so!

Source: Adding Git to Windows 7 Path

Eyad Farra
  • 4,403
  • 1
  • 24
  • 26
  • 4
    This one works very well, I met the problem for installing angularjs tutorial in my IDE (Webstorm). Just have to restart it! – Beber Apr 23 '14 at 12:25
  • @eyad-farra : please mark verified for [Johnathan Douglas](https://stackoverflow.com/questions/20666989/bower-enogit-git-is-not-installed-or-not-in-the-path#21444065) posted answer if solves your problem. Else, try to proceed with some response as other people are also waiting for your response so that they can avoid redundancy in posting same issue. – Sumit Ramteke May 28 '14 at 04:40
  • 2
    After you do this you need to open a new cmd as well ... if you have an existing shell open it won't have the path included. – ajzeffer Dec 12 '14 at 23:03
  • Works in Windows 8.1 too – Kunal Jan 16 '15 at 22:13
  • If you're using SourceTree try adding `C:\Users\\AppData\Local\Atlassian\SourceTree\git_local\bin` to your `PATH`. – falsarella Jun 13 '15 at 03:49
  • it will not work if you have not installed on c: drive – nirmal Jul 10 '15 at 13:01
  • 6
    `%PROGRAMFILES(x86)%` did not work for me, but `C:\Program Files (x86)` did. Not entirely sure why. – KOVIKO Aug 11 '15 at 18:18
  • Every thing's ok but after installing Git a windows restart is needed. – Mohammad Chamanpara Aug 31 '15 at 20:44
  • 7
    `;C:\Program Files\Git\bin;C:\Program Files\Git\cmd` worked for me !! – Nike Sprite Sep 19 '15 at 17:40
  • Please, edit your answer and add @Vojtik's remark: cmd prompt must be restarted after the PATH update, because it can save people a lot of time :) – Yulian Dec 07 '15 at 10:16
  • @Vojtiik. I beg to differ a little. NOT just the command prompt but the SYSTEM must be restarted for changes to take effect. Oh ! I am on windows 7. Not sure about the win8 – HalfWebDev Dec 09 '15 at 19:28
  • 1
    Why all answers are for Windows if the question was explicitly for Linux? – Sdra Jul 19 '16 at 10:02
  • And windows 10 too, just validate first if is C:\Program Files\Git\bin and not something else. – David Lopes Aug 19 '19 at 15:06
219

Just use the Git Bash instead of cmd.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Johnathan Douglas
  • 8,807
  • 2
  • 14
  • 7
  • 5
    Why is that? Anyway this fixed my issue with bower. I ran "bower install" through "Git Shell" (cygwin would also work) on Windows 7 and it worked, where the Node.js command prompt failed. – Eat at Joes Mar 10 '14 at 18:41
  • 4
    For the most part, this is a correct answer. However, [some extensions](https://visualstudiogallery.msdn.microsoft.com/65748cdb-4087-497e-a394-2e3449c8e61e) will depend on cmd, rather than bash, and will need git in the path of cmd. – StuperUser Aug 19 '15 at 13:51
  • This is the simplest solution and works. "Git Bash" is called "Git Shell" in Windows. This works possibly because novice people prefer to use the first option when installing git. – Ram Dec 12 '15 at 15:14
  • used Git Bash instead of Powershell as well. – Judy007 Dec 09 '16 at 22:32
71

Run the following command at your node.js command prompt where "<git path>" is the path to your git bin folder:

set PATH=%PATH%;<git path>;

So, like this:

set PATH=%PATH%;C:\Program Files\Git\bin;

Or this: (Notice the (x86) )

set PATH=%PATH%;C:\Program Files (x86)\Git\bin;

This will add git to your path variables. Be sure you type it correctly or you could possibly delete your path vars which would be bad.

skinneejoe
  • 3,921
  • 5
  • 30
  • 45
  • You may also need add %PROGRAMFILES(x86)%\Git\cmd to the path, ej: set PATH=%PATH%;%PROGRAMFILES(x86)%\Git\bin;%PROGRAMFILES(x86)%\Git\cmd – MCurbelo Mar 23 '15 at 21:31
  • exit your cmd window and start a new one after PATH change. I had to do that after installing msysgit for cmd to pick up new PATH value. – Calvin Dec 03 '15 at 19:37
  • Simple and Clean solution. WOW – Ali Kazmi Oct 07 '17 at 04:50
27

Make sure you installed Git with the second or third option selected from the list. It will penetrate the Git command to cmd by modifying PATH automatically ;)

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • This doesn't work for the option 2.Not sure about option 3. Adding a path variable manually only does and reflects the true state after a restart. – HalfWebDev Dec 09 '15 at 19:19
18

I had the same error in Windows. Adding git to the path fixed the issue.

G:\Dropbox\Development\xampp\htdocs.penfolds.git\penfolds-atg-development>bower install
bower bootstrap#~3.0.0          ENOGIT git is not installed or not in the PATH

G:\>PATH
PATH=E:\Program Files\Windows Resource Kits\Tools\;

G:\Dropbox\Development\xampp\htdocs.penfolds.git\penfolds-atg-development>set PATH=%PATH%;E:\Program Files\Git\bin;

G:\Dropbox\Development\xampp\htdocs.penfolds.git\penfolds-atg-development>bower install
bower bootstrap#~3.0.0      not-cached git://github.com/twbs/bootstrap.git#~3.0.0
bower bootstrap#~3.0.0         resolve git://github.com/twbs/bootstrap.git#~3.0.0
kaiser
  • 21,817
  • 17
  • 90
  • 110
user1491819
  • 1,790
  • 15
  • 20
13

I am also getting the same error and the solution is first to check if the Git is installed or not in the system and if not please install it.

After installation, open Git Bash or Git Shell from Windows and go to your project (same way you go in command prompt using "cd path"). Git Shell is installed by default with Github windows installation.

Then run the same bower install command. It will work as expected.

The below screenshot shows the command using Git Shell Bower install using Git Shell

arshovon
  • 13,270
  • 9
  • 51
  • 69
Rahul Sonone
  • 2,685
  • 1
  • 27
  • 38
13

On Windows, you can try to set the path at the command prompt:

set PATH=%PATH%;C:\Program Files\Git\bin;
AGN Gazer
  • 8,025
  • 2
  • 27
  • 45
GibboK
  • 71,848
  • 143
  • 435
  • 658
7

When you ran the git install, you probably didn't choose:

"Use Git from the Windows Command Prompts"

during the installation.

Re-run git install, and choose that option.

mtyson
  • 8,196
  • 16
  • 66
  • 106
6

You are missing the ENVIRONMENT PATH. Follow these steps:

  1. Search for 'Edit the system environment variables'.
  2. Click on 'Environment Variables'.
  3. In the 'System variables' section, scroll down and click on the variable 'Path'. Click 'Edit'.
  4. Append this text to the end of the 'Variable value'.

;%PROGRAMFILES%\Git\bin;%PROGRAMFILES%\Git\cmd

Matt
  • 33,328
  • 25
  • 83
  • 97
3

I also got the same problem from cmd and resolved using the following steps.

First install the https://msysgit.github.io/ (if not alredy installed). Then set the Git path as suggested by skinneejoe:

set PATH=%PATH%;C:\Program Files\Git\bin;

Or this (notice the (x86)):

set PATH=%PATH%;C:\Program Files (x86)\Git\bin;
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mohit
  • 191
  • 1
  • 12
1

In Linux:

if you dont have installed git use:

sudo apt-get update
sudo apt-get install git

with command which git you will know the directory where is and then add in path if it is not in that enviroment variable.

Dave
  • 7,028
  • 11
  • 35
  • 58
0

I bumped into this problem on a cPanel CentOS 6 linux machine. The solution for me was to symlink the cPanel git to /usr/local/bin/git

ln -s /usr/local/cpanel/3rdparty/bin/git /usr/local/bin/git
adrianthedev
  • 626
  • 1
  • 11
  • 21
0

1.Set the Path of Git in environment variables. 2.From Windows command prompt, run cd Project\folder\Path\ run the command: bower install

Yaaseen
  • 11
  • 3
0

People above already gave solutions for your proplem, I hope so. If someone is facing this issue in 2022 in using docker images, then you should add a command to install git in your image.

For Example you are using alpine image in your Dockerfile. Then it will be something like this :


FROM node:8.3-alpine

# ....... other stuffs .....

RUN apk add git


# ....... other stuffs .....

-1

I solved the problem by install Git Bash from Download Git Bash.

Setting this option 3 when installing the software as shown bellow.

Setting Path variable

Finally select the project folder by right click using Bash as shown below.

enter image description here

and type

npm install

. It works for me.

Hassan Rahman
  • 4,953
  • 1
  • 34
  • 32
-2

npm install from git bash did work for me. After rebooting PC.

Wojciechu
  • 3,314
  • 2
  • 14
  • 10
-3

Just use the Git Bash instead of node.js or command prompt

As an Example for installing ReactJS, after opening Git Bash, execute the following command to install react:

bower install --react
LOwens1931
  • 33
  • 3
-4

I had the same problem and needed to restart the cmd - and the problem goes away.

Yoky
  • 832
  • 10
  • 20