i have a windows machine that i installed git
on it . on install i checked the add the gitbash to environment
but after install when i run a smiple command like ls
in my windows cmd i get the error
'ls' is not recognized as an internal or external command,
operable program or batch file.
now this is my env variables on my windows
the second one was added by git automatically on install but I add the first one by searching on stack overflow but none of them seems to work .
Extra Details :
in case you want to know what trouble it cause me . i am running some make
commands that works properly on my gitbash
but on my goland terminal it gives this error
./scripts/fmt.sh provider
process_begin: CreateProcess(NULL, sh C:\Users\farsh\go\src\gojeh\scripts\fmt.sh provider, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [Makefile:16: run] Error 2
CodePudding user response:
TL;DR
Git for Windows deliberately only puts the bare minimum on your Windows PATH
Details
If you look at the git\bin
directory, you'll see that only git
, bash
and sh
are there. Then there's a git\usr\bin
directory will the standard *nix-style utilities you're expecting, including ls
, although not including make
on my machine. Those are not added to your Windows path, because many of them would conflict with the standard Windows utilities, and shadowing them could have unpredictable effects on other stuff running in Windows.
So you'll find the extra stuff is only visible when you're running inside Git Bash itself, where they're expected to work the *nix way.
If you need make
for your system, you should probably install a version intended to be used on Windows.