In 2021, how to set git bash as the terminal of vscode?

EricKnight 2021-09-15 09:45:28

Open today VSCode Prepare code , Open the terminal , It was found that the original configuration bash It's not working , Only PowerShell and Command Prompt. It's uncomfortable , So I searched the Internet , Unfortunately, they are all old sesame seeds and rotten millet , None of them works .

So we use "terminal.integrated.shell.windows" To configure the terminal , But in 2021 year 4 The month has deprecated this field , Now use the latest "terminal.integrated.profiles.windows" To configure the , The configuration is as follows :

// setting.json
{
// Terminal configuration 
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"icon": "terminal-cmd"
},
"GitBash": {
"path": ["C:\\Program Files\\Git\\bin\\bash.exe"],
"icon": "terminal-bash"
},
},
"terminal.integrated.defaultProfile.windows": "GitBash",
}
 Copy code 

The detailed steps :

  1. open “ Set up ”

Untitled.png

  1. Search... In the search box :terminal.integrated.profiles.windows

Untitled 1.png

  1. Click below : stay settings.json Editor in chief , Enter into settings.json file

    Then write the terminal configuration , After that, please look at chapter 4 Step .

    Be careful :

    a. "terminal.integrated.defaultProfile.windows": "GitBash" After this setting , After opening the terminal , By default bash As a terminal ;

    b. Git Bash Please fill in the path on your computer bash.exe The location of .

  2. Last , Be sure to restart VSCode Editor , Then open the terminal and try again .


Reference resources :dev.to/andrewriver…

Please bring the original link to reprint ,thank
Similar articles

2021-09-15