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.
I just got this error while trying to use the Worktrees tab from the GitLens extension. With git worktree list I found out I had some prunable worktrees, so it worked again after I ran this:
git worktree prune
In Mac OS you have to modify your settings.json. For me currently located in Users//Library/Application Support/Code/user/settings.json
or what it is the same ~/Library/Application Support/Code/user/settings.json
There set "git.path": "/usr/local/bin/git",
You can achieve the same inside Visual Studio Code going to the "Settings" Gear Icon > Settings Then search for git. Under Extensions go to Git and look for Path Click on Edit in settings.json
It will open the same file inside the editor
See the image for VSCODE
install git, and run git init
If you are getting this error from a React app created using Create React App, i.g. create-react-app nameOfYourApp, you need to setup CircleCI environment. More info here https://facebook.github.io/create-react-app/docs/running-tests
On your own environment
Windows (cmd.exe)
set CI=true&&npm test
set CI=true&&npm run build
(Note: the lack of whitespace is intentional.)
Windows (Powershell)
($env:CI = "true") -and (npm test)
($env:CI = "true") -and (npm run build)
Linux, macOS (Bash)
CI=true npm test
CI=true npm run build
Related
I created a new user on my windows PC and can't get flutter to work on it.
Flutter and git are both installed in a shared folder (like C:\shared_programs\...).
I made sure that both users have full access in the security properties of that folder.
I added all these to the System Path Variable:
C:\shared_programs\flutter\bin
C:\Windows\System32
C:\shared_programs\Git\cmd
When I run where git or where flutter, the correct paths are printed.
But when I run flutter, it returns "Error: Unable to find git in your PATH."
Why? How do I fix this?
(I think this question is not a duplicate because this question was fixed by adding something to the path which I already did, and this question is about the where command not working, which isn't my problem. And this one also doesn't work for me.)
I had a similar problem and your post incited me to investigate it further.
Fvm had installed flutter 3.7.0 through cmd. Using cmd I could also successfully run git rev-parse HEAD in the flutter sdk folder.
It seems however that executing the same command through powershell didn't work (and IntelliJ uses powershell for me).
By calling the following command in powershell this fixed it for me: git config --global --add safe.directory C:/path_to_fvm_home/versions/3.7.0
Originally from here.
Versions:
VSCode Version: 1.46.1
OS Version: Windows_NT x64 10.0.20161
Steps to Reproduce:
Install debian-dev-boilerplate inside WSL.
Setup powerlevel 10k.
Clone a git repo and enter its folder.
git clone git#github.com:DanielAtKrypton/debian-dev-boilerplate.git
cd debian-dev-boilerplate
You should now see something like:
Open vscode from zshell. By typing at the zshell prompt:
code .
At this point the bug is revealed when the terminal is opened for the first time inside vscode. At first glance, the terminal renders correctly the powerlevel10k theme. After half a second, the theme is deactivated as can be seen in the next picture.
Does this issue occur when all extensions are disabled?:
Yes. The first time vscode is launched, it installs a vanilla (with no extensions) vscode-server to the linux distro. And still the bug happens.
It is interesting to note that in prior vscode versions this functionality was working alright. For any reason I don't know this issue started to happen in the last couple weeks.
Additional Info:
Here is the log file when running the commands:
code . --log trace
exthost.log
Most likely Powerlevel10k has been installed and/or loaded from ~/.zshrc incorrectly. The screenshot of VS Code shows robbyrussell theme, so I surmise that you are using Oh My Zsh. To install Powerlevel10k on top of Oh My Zsh you need to follow these instructions:
Run: git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc.
Try running grep -E 'ZSH_THEME|/powerlevel10k' ~/.zshrc. The output must be exactly like below.
ZSH_THEME="powerlevel10k/powerlevel10k"
If it's not, you need to fix ~/.zshrc.
I've just tried to install Flutter on windows 10. When I try to run a flutter command (flutter doctor), I'm getting
Error: Unable to find git in your PATH.
I have set the path to both git and flutter and tried adding the following to path
C:\Program Files\Git\bin\git.exe;C:\Windows\System32
How can I resolve this???
Go to my flutter installation folder and inside flutter/bin edit the flutter.bat file using a text editor and remove the line (Line 33 in mine) that says
IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path%
The code should look like this on those lines
REM If available, add location of bundled mingit to PATH
SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd
REM Test if Git is available on the Host
where /q git || ECHO Error: Unable to find git in your PATH. && EXIT /B 1
Save and Run flutter doctor and everything should work fine.
I guess its something to do with the path variables being confused.
You could try reinstalling Git with "Use Git and optional unix tools from the command prompt" selected in the installer.
This would add git and the unix tools to the path. You may have installed with only 'Use Git from Bash only' selected?
Find the flutter.bat in your flutter folder which should be inside flutter/bin and edit the flutter.bat using your text editor.
Remove the below line from the file (Mine was Line 33)
IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path%
The file should look like this after you remove it
REM If available, add location of bundled mingit to PATH
SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd
Save and Run flutter doctor and everything should work fine.
I guess its something to do with the path variables being confused.
Before
After
Set the path up to bin
C:\Program Files\Git\bin
then try
git --version
if still not working, reinstall git
check these two threads for the further issues
SO
GH
It turns out I didn't have git installed
https://git-scm.com/downloads
https://git-scm.com/downloads
I'm using VSCode with git bash and minGW. Every time I restart VSCode the PATH is reset to default. I add my path to mingw with export PATH=$PATH:/c/mingw/bin
How can be permanent changed? I created .bashrc in my code folder but it doesn't works
Thanks
Search for "path" in the windows control panel. you can then "edit the system environment variables". You can edit it in to the system path.
You will need to restart VSCode after you change it, then it will be there every time..
Note that in the future this may cause problems if you have a separate version of something using mingw dlls.
I have setup my integrated terminal to be bash as shown below:
{
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
}
Bash is working but when I try to run things like npm, node, ect it says the command is not found. If I run the standalone git bash.exe (not the one in the bin folder) it works correctly but you have to run the one in the bin folder to have it integrated, what do I need to do to fix it?
Add "terminal.integrated.shellArgs.windows": ["--login","-i"] to your settings. You may have noticed git bash.exe runs with these arguments.
I had a similar issue (missing arguments) when setting up an integrated terminal with Visual Studio - although I haven't had a problem with VSCode.