How to change the terminal of VSCode to Git Bash

created at 01-19-2022 views: 6

why change to Git Bash?

If you are developing on Windows, but you are more familiar with Linux command lines, then by switching to Git Bash from CMD or PowerShell will give you extreme convenience in your work.

How?

First step, you need find the bash.exe of Git, which would be under the your\\path\\ to\Git\\bin\\ directory.

then, in VScode, open the settings.json, search for two configurations (you can use Ctrl + F to search):

  • terminal.integrated.profiles.windows
  • terminal.integrated.defaultProfile.windows

these are the two things we need to make some change like bellow. If you can't find them, just append them at the end of the settings.json like below:

{
...
"terminal.integrated.profiles.windows": {
    "PowerShell": {
        "path": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
        "icon": "terminal-powershell"
    },
    "CommandPrompt": {
        "path": [
            "${env:windir}\\Sysnative\\cmd.exe",
            "${env:windir}\\System32\\cmd.exe"
        ],
        "icon": "terminal-cmd"
    },
    // add this item
    "GitBash": {
        "path": "E:\\programming Tools\\Git\\bin\\bash.exe",
        "icon": "terminal-bash"
    },
},
"terminal.integrated.defaultProfile.windows": "GitBash",
}

note there is a pair of brackets wrapping all the configurations, you should append new configurations inside of them.

note

  • GitBash must be one word, Git Bash won't work!
  • after changing/adding the configuration, we need delete the present Terminal in our window:

    delete the current terminal * then restart VSCode, press Ctrl+"`" to open terminal, you will get the Git Bash:

    Git Bash

created at:01-19-2022
edited at: 01-25-2022: