Git bash is installed and integrated but I don't see it in the terminal list of vs code - visual-studio-code

All other terminals are visible enter image description herein the list like command prompt, etc. But, Git bash is not showing up. I am worried If I have installed and integrated Git properly. I am sharing the settings.json. Please, let me know where I am wrong or I can share more info

Open you settings.json file and add the following at last.
"terminal.integrated.profiles.windows":{"GIT BASH ADDED ":{"path":"C:\\Program Files\\Git\\git-bash.exe"}, },
"terminal.integrated.defaultProfile.windows": "Git Bash"
Remember to add the path of your git-bash.exe correctly (wherever you have installed it).
see the screenshot for you reference.

Related

VSCode opens different workspace from commandline and gnome launch icon on Fedora

I have VSCode 1.65.2 running on Fedora 35, and I always launch it from Gnome (by clicking on the VSCode icon). I recently wanted to set up VSCode as the editor for git by running git config --global core.editor "code -r --wait", so that if I would run e.g. git commit in VSCode's integrated terminal, it would open the commit message in the already open VSCode window. But the result is that it always opened a new window, even though I passed -r to it.
I found out that VSCode launched from the command line used settings from the ~/Code folder, while if I launched it from Gnome (by clicking on the icon), it used ~/.config/Code for my settings.
So I created a symlink from ~/Code to ~/.config/Code, and I hoped that it would solve this issue.
It did not.
It still always behaves differently if I launch it from Gnome and if I launch it from the command line.
How can I solve this?

Git-Bash in Visual Studio Code from the D drive

I am trying to use Git Bash as a terminal in Visual Studio Code, however I am not able to find it in the terminal profiles. The option for Git Bash doesn't appear in the available terminals. I have installed Bash already. However I did it in the D drive. Is there a way to make git-bash available to choose as a terminal or even make it the default one from the D drive?
You can create your own profile in the setting.json file and set the default terminal profile to it, like so (for Windows):
"terminal.integrated.profiles.windows": {
"My Git Bash":{
"path": "D:\\GitbashLocation\\git-bash.exe",
"icon": "terminal-bash"
}
},
"terminal.integrated.defaultProfile.windows": "My Git Bash",
Note that you can name your profile whatever you want. You may also need to restart Visual Studio Code after defining your profile so it detects it when you specify it in the terminal.integrated.defaultProfile.windows setting.
I was also struggling with the same but finally got it fixed with thanks to the final bit of help needed from #Timothy G's answer, with the help of other posts here on stack as well.
Let me just post a step-by-step solution adding to the #Timothy G's answer below, JIC if you're still struggling with it and also for future visitors.
Note: I'm using VS Code Insiders build (Version: 1.64.0-insider(user setup)) on Windows, but should work for other builds as well.
Since you have already downloaded git bash, ignore the 1st step.
Download git bash from the https://git-scm.com/download/win.
Open VS Code ⟹ File ⟹ Preferences ⟹ Settings. (Ctrl + ,).
There will be a search bar on top.
Search for terminal.integrated.profiles.windows.
A result will come up that would look like this
Terminal › Integrated › Profiles: Windows
The Windows profiles to present when creating a new terminal via the terminal dropdown. Use the source property to automatically detect the shell's location. Or set the path property manually with an optional args.
Set an existing profile to null to hide the profile from the list, for example: "Ubuntu-20.04 (WSL)": null.
Edit in settings.json
Click on Edit in settings.json.
Then another window will pop up next to the Settings tab called settings.json
Copy and paste this inside the settings.json. Remember to set the “path” to your git bash.exe in the bin folder
You can remove the first two lines if you don't need it and do Ctrl + S to save the JSON settings.
{
"workbench.colorTheme": "Default Dark+",
"files.autoSave": "afterDelay",
"terminal.integrated.profiles.windows": {
"My Git Bash":{
"path": "I:\\Projects\\git\\bin\\bash.exe",
"icon": "terminal-bash"
}
},
"terminal.integrated.defaultProfile.windows": "My Git Bash",
}
After adding the above, select the “Settings” tab again and search for terminal.integrated.defaultProfile.windows
Then you'll be presented with a terminal feature like this with a drop-down.
Terminal › Integrated › Default Profile: Windows
The default profile used on Windows. This setting will currently be ignored if either terminal.integrated.shell.windows or terminal.integrated.shellArgs.windows are set.
Under the drop-down, select the profile My Git Bash then you're
all set.
Then got to ⟹ View ⟹ Terminal. (Ctrl + `)
It should now show up with the bash terminal. If it doesn't, restart VSC and it'll work for sure.
In order to make Timothy G.'s answer work, first, add the new profile as described in the VSCode documentation:
Step 1: "To create a new profile, run the Terminal: Select Default Profile command and activate the configure button on the right side of the shell to base it on. This will add a new entry to your settings that can be tweaked manually in your settings.json file."
https://code.visualstudio.com/docs/editor/integrated-terminal#_terminal-profiles
Type in a new name in the input box after you click the "configure" button. This will create a new profile in settings.json with your new name cloned from an existing profile (against which you clicked the "configure" button).
Step 2: Go to the settings.json file. You will see the profile with your new name added there. Update it with Timothy G's settings. Here is how mine looks like:
{
"My Git Bash": {
"path": "D:\\Git\\bin\\bash.exe",
"icon": "terminal-bash"
}
"terminal.integrated.defaultProfile.windows": "My Git Bash"
}
Step 3: Save and restart VSCode. The next time the terminal will open with Git Bash.

How to Add Git Bash to VsCode

It is not showing Git Bash Option in while selecting terminal in VsCode
Make sure you have already installed Git for Windows
In VS Code, go to Command Palette (⇧⌘P) with Terminal: Select Default Profile or Terminal: Select Default Shell in older versions, then select available shell in this case, Git Bash, in the dropdown list.
Click on + sign next to terminal list as shown below:
At this point, the Git Bash should be successfully added.
PS. The list might disappear if the VS Code is closed. Only the default shell will show up. You have to do the steps above again.

Terminal started behaving badly when Zshell theme is present

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.

How to integrate git bash in visual studio code

How to integrate git bash in visual studio code? I typed " open user setting " then I am getting this window:
VSCode has support for git built in.
You might need to check that the directory containing the git executable is on your PATH environment variable. Alternatively, in settings.json, set git.path, for example:
{
"git.path": "d:/opt/git-for-windows-2.23.0/bin/git.exe"
}
You also need to install git first.
Following steps have to be followed to integrate Git Bash with Visual Studio Code:
Step-1
You have to open settings by File->Preferences->Settings or by pressing Ctrl+, AND click on the Open Settings(JSON) icon on the top right corner of vs code editor
Step-2
On clicking, you will see the settings page. You have to copy:
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
and paste at the last of all settings. Make sure that you have installed git bash on your computer.
Step-3
And that’s all when you will reopen VS Code then you will see that Git Bash has been integrated. Now you can run Git Bash commands directly in VS Code.