Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code Error: spawn git ENOENT

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..

like image 882
dapidmini Avatar asked Mar 02 '17 02:03

dapidmini


3 Answers

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.

enter image description here

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.

enter image description here

like image 70
Shaun Luttin Avatar answered Oct 18 '22 19:10

Shaun Luttin


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)". add vscode to path

like image 32
Bravo Yeung Avatar answered Oct 18 '22 17:10

Bravo Yeung


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.

like image 3
markus Avatar answered Oct 18 '22 18:10

markus