Setting Up Visual Studio Code & Git Bash Terminal On Windows

A good Windows development setup should let you edit code, run commands, and track changes without constantly switching between applications. Visual Studio Code and Git Bash make a useful pairing: VS Code provides the editor, while Git Bash gives you Git and familiar Bash commands in a Windows-friendly package.
The important detail is that installing Git does not automatically make Bash the default terminal in VS Code. You need to connect the two, and make sure Windows can find the tools you intend to use.
This guide describes the setup as of 2019; tools, settings, and interfaces may have changed since then.
By the end, you will have VS Code installed, Git available from the command line, and an integrated Git Bash terminal that opens inside your project folder.
Understand what you are installing
Before downloading anything, it helps to separate three related tools:
- Visual Studio Code is Microsoft's free code editor, with extensions, debugging support, and built-in Git integration. It is not the same product as Visual Studio.
- Git is the version-control system that records changes to your files.
- Git Bash is a Bash environment included with Git for Windows. It provides Git alongside utilities such as
ls,cat, andgrep.
Git Bash is not a full Linux installation. It makes many Unix-style commands available on Windows, but it does not replace Windows or provide every Linux utility. For editing projects and running Git commands, it is a practical starting point.
You will need an internet connection and permission to install software. Administrator access depends on whether you choose a per-user or system-wide installation.
1. Install Visual Studio Code
Download the Windows installer
Visit the official Visual Studio Code website and download the Windows installer that matches your computer.
For most individual developers, the User Installer is convenient because it installs VS Code for the current Windows account without requiring a system-wide installation. Use the System Installer if your environment calls for an installation shared by multiple users.
Run the installer, accept the license terms, and keep the default destination unless you have a reason to change it.
Choose useful installation options
On the additional tasks screen, consider enabling:
- Add to PATH, so you can launch the editor with the
codecommand. - Open with Code context-menu entries for files and folders, if offered.
- Registration of Code as an editor for supported file types, if that suits your workflow.
The PATH option is particularly useful. It lets you navigate to a project in Git Bash and open it with:
code .
The dot means “the current directory.”
Complete the installation and launch VS Code. If you already had a terminal open during installation, close and reopen it before testing the code command. Existing processes do not automatically receive updated environment variables.
2. Install Git for Windows
Download the package that includes Git Bash
Go to the official Git for Windows website and download the installer. Git Bash is included in this package; you do not need a separate Bash download.
Run the installer and note the installation directory. A typical system-wide location is:
C:\Program Files\Git
You will use that location later when configuring VS Code.
Select an editor and PATH configuration
The installer presents several choices. Most defaults are suitable, but two deserve attention.
First, choose the default editor Git should use when it needs a commit message or another text entry. If Visual Studio Code appears in the list, select it.
Second, choose the PATH option labeled Git from the command line and also from 3rd-party software, or the equivalent wording in your installer. This makes Git accessible to VS Code and other applications without exposing every bundled Unix utility globally.
Avoid choosing the broadest PATH option simply because it sounds more complete. Adding Unix utilities to the Windows PATH can cause command-name conflicts with Windows tools.
Review line endings and terminal choices
For line endings, the usual Windows default, checking out Windows-style endings and committing Unix-style endings, is a reasonable starting point. If you are joining an existing project, follow its conventions instead. A repository may use a .gitattributes file to define line-ending behavior consistently.
The installer may also ask you to choose between MinTTY and the Windows console for Git Bash. Keeping the default MinTTY choice is fine. This affects the standalone Git Bash window; VS Code uses its own integrated terminal interface.
Finish installation, then close and reopen VS Code so it can detect the updated environment.
3. Verify Git Bash and configure Git
Open Git Bash from the Windows Start menu. Check that both Git and Bash are available:
git --version
bash --version
Both commands should print version information. The exact numbers depend on the installer you downloaded.
Next, set the identity Git will attach to your commits. Replace these example values with your own:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
These settings identify commit authors; they do not log you into GitHub or another hosting service. Choose an email address you are comfortable including in repository history, especially for public projects.
If you want VS Code to be Git's editor, verify that code --version works, then run:
git config --global core.editor "code --wait"
The --wait flag tells Git to wait until you close the editing file before continuing. Without it, Git may proceed before you finish writing a message.
You can inspect these settings with:
git config --global --list
The --global scope applies to your Windows user account. For a repository that needs a different identity, run the same name and email commands inside that repository without --global.
4. Make Git Bash the default VS Code terminal
Locate the Bash executable
For a standard Git for Windows installation, the executable to use is:
C:\Program Files\Git\bin\bash.exe
Confirm that the file exists using File Explorer. If you installed Git elsewhere, use the corresponding bin\bash.exe path.
Do not point VS Code at git-bash.exe in Git's top-level directory. That executable launches the standalone Git Bash application rather than serving as the shell inside VS Code's terminal panel.
Edit the user settings JSON
In VS Code, press Ctrl+Shift+P to open the Command Palette. Search for Preferences: Open Settings (JSON) and open your user settings file.
For the 2019-era terminal configuration, add this setting:
{
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
}
If the file already contains settings, add only the new property inside the existing outer braces. Separate properties with commas rather than pasting a second complete JSON object.
The doubled backslashes are required because backslashes have special meaning in JSON strings. Forward slashes also work here:
{
"terminal.integrated.shell.windows": "C:/Program Files/Git/bin/bash.exe"
}
Use your actual installation path, not necessarily the example above. Keep this machine-specific setting in user settings rather than committing it to a shared project's .vscode/settings.json.
Create a fresh terminal
Save the settings file. Close any existing integrated terminals using the terminal panel's trash-can control, then choose Terminal → New Terminal.
You can also toggle the terminal panel with Ctrl+`. However, toggling the panel may reveal an existing shell rather than launch a new one. Changing the default shell does not convert a running PowerShell or Command Prompt session into Bash.
In the new terminal, run:
echo "$BASH_VERSION"
git --version
pwd
You should see a Bash version, a Git version, and your current directory.
5. Test the setup with a small project
A real folder is a better test than an empty terminal. In Git Bash, create a disposable project under your home directory:
mkdir -p ~/projects/vscode-bash-demo
cd ~/projects/vscode-bash-demo
code .
VS Code should open that folder. Create a new integrated terminal and run pwd to check its location. In a normal single-folder workspace, a new terminal starts in the opened folder unless another terminal working-directory setting overrides it.
Now create and commit a small file:
git init
printf '# VS Code and Git Bash demo\n' > README.md
git status
git add README.md
git commit -m "Add initial README"
git log --oneline
This verifies that Bash commands work, Git can create a repository, and your commit identity is configured.
Open VS Code's Source Control view to see the same repository through the editor. The integrated terminal and Source Control view operate on the same Git data; they are two ways to interact with your project, not separate version-control systems.
Practical tips for everyday use
Use Bash-style paths
Git Bash represents Windows drive letters as directory prefixes. For example:
cd /c/Users
cd "/c/Users/Your Name/My Projects"
Quote paths containing spaces. Avoid pasting unquoted Windows paths such as C:\Program Files\Git directly into Bash commands: Bash treats backslashes as escape characters.
Use pwd to check your current directory, ls to list files, and cd .. to move up one level.
Keep shell configuration simple
You do not need a customized startup file to use Git Bash in VS Code. Begin with the default environment and add aliases or prompt changes only after the basic setup works.
If standalone Git Bash and the integrated terminal later behave differently, compare their startup behavior and environment before reinstalling anything. Bash login and non-login shells can read different startup files.
Common problems and fixes
The terminal still opens PowerShell
Close the existing terminal session and create a new one. Then check that the shell setting is saved in user settings and that no workspace setting overrides it.
VS Code cannot launch Bash
Check the executable path in File Explorer. Common causes are a custom Git installation directory, incorrect JSON escaping, or selecting git-bash.exe instead of bin\bash.exe.
Git works in Git Bash but VS Code cannot find it
Restart all VS Code windows first. If that does not help, confirm the Git installer added Git to PATH. As a fallback, the 2019-era git.path setting can point VS Code's Git integration to the executable:
{
"git.path": "C:\\Program Files\\Git\\cmd\\git.exe"
}
This setting helps the editor locate Git; it does not change the terminal shell or repair the system PATH.
A commit fails because identity is missing
Run the user.name and user.email configuration commands above, then retry the commit. Reinstalling Git will not solve missing author settings.
Takeaway
Install VS Code, install Git for Windows, verify Git, and point VS Code's integrated terminal at bin\bash.exe. Once a test repository works from both the terminal and Source Control view, you have a practical Windows development setup with editing, shell commands, and version control in one place.
Conversation (0)
No comments yet. Start the conversation.
Join the conversation
Create a free member account to comment.