the "code" function isn't working on Git Bash (windows) - visual-studio-code

I recently factory reset my computer, after installing git bash I noticed that the "code" function og VS CODE wasnt working, it was returning an error:
bash: code: command not found
and so i went online and tried to look fot a solution, all i could find was adding it to PATH. well i checked and its there (echo $PATH):
/c/Users/tomas/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/tomas/bin:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Python39/Scripts:/c/Python39:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files/nodejs:/c/ProgramData/chocolatey/bin:/c/Users/tomas/AppData/Local/Programs/Python/Python38/Scripts:/c/Users/tomas/AppData/Local/Programs/Python/Python38:/c/Users/tomas/AppData/Local/Microsoft/WindowsApps:/cmd:/c/Users/tomas/AppData/Roaming/npm:/usr/bin/vendor_perl:/usr/bin/core_perl:/Applications/Visual Studio Code.app/Contents/Resources/app/bin
(maybe this is just me not understanding how git bash $PATH syntax works but i checked it through enviroment variables and the path was there)
i also reinstalled vs code and git bash and still no luck, thx fot the help in advance

Related

Flutter Unable to find git in your PATH (Windows)

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

Can't connect to jupyter server in vscode

My settings file looks like this
{
"python.pythonPath": "/home/username/.conda/envs/myenv/bin/python",
"terminal.integrated.inheritEnv": false
}
And I can see the conda environment in the interpreter that I'd like to activate from vscode interpreter selections but whenever I try to run the a cell in vscode I get a long error message.
Activating Python 3.7.7 64-bit ('myenv': conda) to run Jupyter failed with Error: Command failed: . activate myenv && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /home/username/.vscode/extensions/ms-python.python-2020.8.105369/pythonFiles/pyvsc-run-isolated.py /home/username/.vscode/extensions/ms-python.python-2020.8.105369/pythonFiles/printEnvVariables.py bash: activate: No such file or directory .
I chdecked my $PATH variable and it each directory existed in it. (Looks like how other stack questions suggested it should look as well)
What am I missing? I had it working on a similar machine a couple weeks ago but I can't seem to get it to work now.
I'm on Ubuntu 20.04 if that's important.
I am not completely familiar with the issue, but some digging around lead me to this, try these settings
"terminal.integrated.env.linux": {
"PATH": ""
}
If that doesn't work please reference this link. They seem to be experiencing the same issue as you, but on windows. You may be able to extract more information from it than I could. Sorry if this didn't help.
After messing around quite a bit, I made a new environment and it worked. I'm not sure what I did within that environment to make vscode unhappy with it but vscode didn't like something about it.
Before making the new environment I also ran a few commands including
sudo chown -R $USER:$USER ~/.conda
sudo chown -R $USER:$USER ~/miniconda3
conda update -n base -c defaults conda
I'm not sure what got it to work but I'm happy it's working now!

What is the path of code for wsl, hence Vscode installed in users profile

I have on Windows10 and WSL.
vscode is installed on Windows and not on WSL.
When I open WSL and run: code I am getting following error: command not found: code
I have reinstalled vscode and also tried with vscode insider and always checked to add PATH on installation.
The env var PATH does not contain a hint where to look and I also tried "appData/Local/Programs/Microsoft VS Code/bin/code". I am getting an error message: permission denied.
A little bit too late, but in case someone comes here.
The simplest way is to create a symbolic link in /usr/local/bin
ln -s '/mnt/c/Program Files/Microsoft VS Code/bin/code' /usr/local/bin/code
You can use the which command to find where the corresponding program file of the command is stored. This is the output on my WSL:
$ which code
/mnt/c/Program Files/Microsoft VS Code/bin/code

Wrong qutation mark in VS Code integrated terminal with Git Bash on Windows 10

For example I get error: no type named â?? instead of error: no type named ‘. If I run WSL bash instead of Git Bash in VS Code integrated terminal, then quotation marks are correct. If I run standalone Git Bash there is no problem either.
I have tried different fonts and themes for integrated terminal with no luck. I think it is related to wrong code page, but I do not know how to change it for Git Bash or VS Code. Thanks in advance.

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