VSCode Integrated Terminal creates a separate window

Viewed 12634

Just installed VSCode and git bash.

I've added the following lines to the settings.json file:

{
    "terminal.integrated.shell.windows": "D:\\Program Files\\Git\\git-bash.exe" 
}

When I press Ctr+` to open the integrated shell window, instead of opening inside the main editor at the bottom it opens a new window:

Git Bash Winow

Why isn't it showing in the usual place?

6 Answers

According to this vscoode GitHub Issue (#7286):

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

The recommended approach is to use:

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

My Solution:

  1. Open settings

  2. Deactivate: Windows Enable Conpty

Windows Enable Conpty

I was infact looking for the solution to this exact problem. @JBD said it correctly however I would just like to add that the git-bash.exe file is kept seperate in the normal program folder of git.

{
    "terminal.integrated.shell.windows": "D:\\Program Files\\Git\\git-bash.exe" 
}

but what you need to link within vs Codes settings is a different file which will enable git bash to run within the vs code terminal. The path to that is in the "bin" folder within the "Git" folder.

{
"terminal.integrated.shell.windows": "D:\\Program Files\\Git\\bin\\bash.exe" 
}

This will allow your git bash to run from within the terminal window of VS Code

For those using Git installed via Scoop, just use the Scoop's installation folder path:

"terminal.integrated.shell.windows": "${env:USERPROFILE}\\scoop\\apps\\git\\current\\bin\\bash.exe",

i was also face this issue but i solved this issue

change path of git bash

"terminal.integrated.shell.windows": "D:\Program Files\Git\bin\bash.exe"

and uncheked legacy console check box in cmd Image of cmd

Not sure about all but in my case, git bash location is changed into the appdata instead of programming file, so you can use same as mentioned:

"terminal.integrated.shell.windows": "C:\\Users\\{user_name}\\AppData\\Local\\Programs\\Git\\bin\\bash.exe",
Related