How to set up Visual Studio Code with Git Bash on Windows

Posted on July 15th 2018 by Zarko

How to set up Visual Studio Code with Git Bash on Windows

Visual Studio Code Logo

This article will show you how to set up Visual Studio Code editor and integrate Git Bash into it,(a terminal shell which will allow you to use UNIX terminal commands and utilities on your Windows operating system)

Make sure to first follow this tutorial to set up Git Bash on your Windows operating system:
https://zarkom.net/blogs/how-to-install-git-and-git-bash-on-windows-9140

After you are done with that, fetch the Visual Studio Code installer here: https://code.visualstudio.com/download

Visual Studio Code Windows Download

When the download finishes, run the VSCodeSetup .exe installation file (press 'Yes'/'Run' when the Window security dialog pops up)

1) Press the 'Next' button in the installation welcome screen.

Visual Studio Code Windows Installation

2) Select the 'I accept the agreement' option (after reading the license agreement) and press 'Next'.

nvm Windows Installation

3) Leave the default installation path and click 'Next' to continue.

Visual Studio Code Windows Installation

4) Remember the Start Menu folder which will be created for Visual Studio Code - you can use the shortcut there to start the code editor, then press 'Next' to continue.

Visual Studio Code Windows Installation

5) You can tick the options marked in the screenshot, and leave everything else as it is, and again press 'Next' to continue.

Visual Studio Code Windows Installation

6) Press 'Install' to initiate the installation process.

Visual Studio Code Windows Installation

7) After it completes, you can click 'Finish' to finalize the installation. Leave the 'Launch Visual Studio Code' ticked so the editor starts right after.

Visual Studio Code Windows Installation

Setting up Visual Studio Code with Git Bash

8) In Visual Studio Code, press File, then go to Preferences -> Settings

Visual Studio Code Welcome Screen

9) On the left side of the 'User Settings' interface you can see the default settings, while on the right side you can set your custom User Settings.

You can search for particular settings using the input field up top. We want to change the integrated terminal for the editor, so we searched for terminal.integrated.shell.windows

We can see it's set to Powershell by default, but we want to change it to Git Bash. The necessary code that we need to add to the User Settings window can be found here:
https://code.visualstudio.com/docs/editor/integrated-terminal

The code we want do add is the following (see the screenshot for additional details):

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

Visual Studio Code Settings - Git Bash

10) Now you can start your integrated Git Bash inside VS Code by using the Ctrl+` keyboard shortcut.

Visual Studio code with integrated Git Bash

To find more information about Visual Studio Code and its features, check the official documentation page:
https://code.visualstudio.com/docs/getstarted/introvideos

And that would be it! Enjoy your new code editor with a shell based integrated terminal.