Steps to Reproduce:
// The path of the shell that the terminal uses on Windows.
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\git-bash.exe"
View -> Toggle Integrated Terminal from menu.In this case, the "TERMINAL" panel shows up but remains in blank, and the git bash shell was opened as a standalone window instead of integrated. Checkout the snapshot below:
Hi.
Try it.
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
@mappy7771 It works perfectly. Thanks much. :+1:
I guess the difference is that: git-bash.exe is a Windows application (with WinMain as entry), but bash.exe is a console application (with main as entry). To be used as integrated shell, the executable must be a console application, so that stdin/stdout/stderr can be redirected.
As this is a pretty common scenario, should we somehow make this documented, at least for git-bash.exe?
@steven-qi this should definitely be added to the docs when a topic is written on the terminal, I've created https://github.com/Microsoft/vscode-docs/issues/343 to follow it up in the eventual documentation. Thanks! :smiley:
@Tyriar Thanks. 馃槃
@mappy7771 bash.exe doesn't seem to load the same profile of git-bash.exe (you lose aliases, colorization etc.)
This workaround forces the profile (you get the whole "git-bash experience"...)
// settings.json
{
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
"terminal.integrated.shellArgs.windows": [
"--init-file",
"C:\\Program Files\\Git\\etc\\profile"
]
}
@steven-qi you should try @mappy7771 recommendation, it works flawlessly.
@jamesxv7 yes, I have been using it for quite a while, and it works well. Thank you for your suggestion.
If you have custom .bashrc and .bash_profile under your %USERPROFILE%, you might also want to add --login to shellArgs in order to load them (for example: when you want to alias WLS bash.exe inside System32 like this):
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
"terminal.integrated.shellArgs.windows": [
"--login",
"--init-file",
"C:\\Program Files\\Git\\etc\\profile"
],
If you only create the
%USERPROFILE%/.bashrc, Git Bash will create a%USERPROFILE%/.bash_profilewhich will load that for you (see it in:C:\Program Files\Git\etc\profile.d\bash_profile.sh)
bash.exe doesn't print with colors. For example, ls command returns all the results same color. but git-bash.exe makes the directories blue. you know a way to make bash.exe colorful as in original bash?
Most helpful comment
Hi.
Try it.
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"