I get the error Error: spawn git ENOENT
when I try to view git history using https://github.com/DonJayamanne/gitHistoryVSCode on VS Code.. I'm very new to VS Code and github. I tried googling for solutions but I only found links about node.js which I don't understand at all..
We need to install Git to use the Git History (git log) extension in VS Code.
Otherwise we will see this when running git log
.
If you have already installed Git, then make sure that it is available from the shell, for example by typing git --version
.
Once you have Git installed properly, you will see this when running git log
.
That means you need to set environment variable in system for git
. After you set it well, the issue will disapper.
If your OS
is Windows:
Try typing "git --version" in the system command line (do not use git bash
by mistake). If you cannot see the version, it indicates that git
is not added to the environment variables.
For example, my Git
is installed on the disk "C:\", I need to add "C:\Program Files\Git" to the path of the environment variables
.
Method 1:
Steps:
Edit environment variables -> System Variables
Edit Path
,
add
;C:\Program Files\Git\bin\git.exe;C:\Program Files\Git\cmd;
to current value of Path
(remove the beginning ;
if redundant).
You need to adjust this file path according to your actual directory where git is installed.
Then restart your command line, and then try typing "git --version" again. If you can see python version now, try your vs code again, the issue you metioned will disappear.
Another method:
Reinstall your visual studio code with checking "Add to PATH (available after restart)"
.
I had the same issue on MacOS (running VS Cod 1.26.1). With difference to other info that I had found, I worked only after setting:
"git.path": "/usr/local/bin/git"
No success setting the path to null or any other.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With