How to set Git Bash as integrated terminal in VSCode in 2021

andrewriveradev

Andrew

Posted on May 13, 2021

How to set Git Bash as integrated terminal in VSCode in 2021
  "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"],
      "source": "Git Bash",
      "icon": "terminal-bash"
    },
    "terminal.integrated.defaultProfile.windows": "GitBash",

Enter fullscreen mode Exit fullscreen mode

As of April 2021 "terminal.integrated.shell.windows" is deprecated in VSCode.

"terminal.integrated.shell.windows": "C:\\...\\...\\bin\\bash.exe",
Enter fullscreen mode Exit fullscreen mode

To configure Git Bash as the default integrated terminal in VSCode version 1.56 on Windows 10

Step 1: Open command palette (CMD + Shift + P)
Step 2: Search "Preferences: Open User Settings (JSON)"
Step 3: Create a new field by typing "" (double quotation key). Inside the quotation type "terminal." a list of options will appear.
Step 4: Select terminal.integrated.profiles.windows. When you select terminal.integrated.profiles.windows it will be expanded to:

"terminal.integrated.profiles.windows": {
  "PowerShell": {
    "source": "PowerShell",
    "icon": "terminal-powershell"
  },
  "Command Prompt": {
    "path": [
      "${env:windir}\\Sysnative\\cmd.exe",
      "${env:windir}\\System32\\cmd.exe"
    ],
    "args": [],
    "icon": "terminal-cmd"
  },
  "GitBash": {
    "source": "Git Bash",
    "path": ["C:\\Program Files\\Git\\bin\\bash.exe"],
    "icon": "terminal-bash"
  }
},
Enter fullscreen mode Exit fullscreen mode

Step 5: Set default terminal to Git Bash

  "terminal.integrated.defaultProfile.windows": "GitBash",
Enter fullscreen mode Exit fullscreen mode

IMPORTANT
The defaultProfile.windows value must be one word to work.

  "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"
    },
    "Git Bash": {
      "path": ["C:\\Program Files\\Git\\bin\\bash.exe"],
      "source": "Git Bash",
      "icon": "terminal-bash"
    },
  }, 
  "terminal.integrated.defaultProfile.windows": "Git Bash",
Enter fullscreen mode Exit fullscreen mode

Does not work!

// End

Documentation:

Related

💖 💪 🙅 🚩
andrewriveradev
Andrew

Posted on May 13, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related