简体   繁体   中英

“ENOGIT git is not installed or not in the PATH” although git is in the user's path

I'm setting up a TeamCity build project, in which I want to assemble a javascript web app, using a powershell script with the following contents:

npm install
bower install
grunt build

When TeamCity runs the script, I get an error

bower jquery-stopwatch#f1bdae95ace634169b50c4a2565116389668edc9
    ENOGIT git is not installed or not in the PATH

although if I log on to the build agent via RDP (using the same user account as the build agent service runs under) and run those command from a PS instance, everything works as expected (bower installs some fifteen more components before the script continues).

Since the first step ( npm install ) takes a few minutes each time, trouble-shooting this through trial-and-error with the TeamCity build is very slow and tedious, but I haven't so far found any other way to reproduce.

What else should I try? What could be the culprit?

This is commonly caused by installing the tools (and therefore changing the PATH variable) after starting the service/program. The environment is initialized on startup, and not reloaded by external changes to the variables.

So, as they say, have you tried turning it off and on again? :)

The solution is to run your command in Git Shell tool which identify the Git path on your machine. Install any of the Git UI tools based on your current OS:

Download Git UI tools:

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

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