Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git bash shell was opened in a standalone window instead of integrated on Windows #7286

Closed
steven-qi opened this issue Jun 7, 2016 · 10 comments
Assignees

Comments

@steven-qi
Copy link

steven-qi commented Jun 7, 2016

  • VSCode Version: 1.2.0
  • OS Version: Microsoft Windows [Version 10.0.10240]

Steps to Reproduce:

  1. Add the following to settings.json
    // The path of the shell that the terminal uses on Windows.
    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\git-bash.exe"
  1. Close and re-open VSCode (so that the new settings.json would take effect).
  2. Choose 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:

integrated shell

@steven-qi steven-qi changed the title Git bash shell was opened in a standalone window instead of integrated Git bash shell was opened in a standalone window instead of integrated on Windows Jun 7, 2016
@mappy7771
Copy link

Hi.
Try it.
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"

@steven-qi
Copy link
Author

@mappy7771 It works perfectly. Thanks much. 👍

@steven-qi
Copy link
Author

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?

@Tyriar
Copy link
Member

Tyriar commented Jun 7, 2016

@steven-qi this should definitely be added to the docs when a topic is written on the terminal, I've created microsoft/vscode-docs#343 to follow it up in the eventual documentation. Thanks! 😃

@Tyriar Tyriar closed this as completed Jun 7, 2016
@steven-qi
Copy link
Author

@Tyriar Thanks. 😄

@carlo-salinari
Copy link

@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"
    ]
}

@jamesxv7
Copy link

@steven-qi you should try @mappy7771 recommendation, it works flawlessly.

@steven-qi
Copy link
Author

@jamesxv7 yes, I have been using it for quite a while, and it works well. Thank you for your suggestion.

@zaenk
Copy link

zaenk commented Jun 10, 2017

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_profile which will load that for you (see it in: C:\Program Files\Git\etc\profile.d\bash_profile.sh)

@c3y
Copy link

c3y commented Oct 21, 2017

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?

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants