How to Add Git Bash to Windows Terminal: A Beginner‘s Guide

Hey there! Have you heard of the cool new Windows Terminal that Microsoft introduced recently? If you do any software development or IT administration work on Windows, then you are going to love it.

In this comprehensive guide, I will show you how to add the popular Git Bash shell to the Windows Terminal app on Windows 10 and 11. By following these steps, you can unlock the full power of the Linux-style Bash shell within the modern Windows Terminal interface.

So let‘s get started! I will explain everything in detail along the way.

A Brief History of Command Line Evolution on Windows

But before we dive in, let‘s do a quick recap of the command line journey on Windows so far.

Back in the MS-DOS days, the only way to interact with a computer was via the command line interface. Then came Windows which introduced the graphical desktop. But the command prompt still remained as cmd.exe to provide access to command line tools.

Decades later, in 2016 Microsoft introduced Windows Subsystem for Linux (WSL) letting you run Linux environments and Bash shell directly on Windows. This was a game changer for developers and sysadmins!

Then in 2019, they released the new Windows Terminal application. This unified all the various command line tools like PowerShell, Command Prompt, WSL distros, etc under one roof.

The result is a feature-packed, customizable terminal that combines the best of both old and new worlds!

Why You‘ll Love the New Windows Terminal

So what makes the Windows Terminal special? Here are some of its standout features:

  • Multiple tabs – Open tabs for PowerShell, Command Prompt, Git Bash, etc simultaneously
  • Split panes – Divide your window horizontally or vertically
  • Themes and customization – Choose your own color schemes, backgrounds, font styles!
  • Smooth text rendering – Uses GPU acceleration for buttery smooth text
  • Retro terminal emulation – Integrated connections to old school terminals
  • Developer friendly – Great for those working on code and tools

It provides a modern, efficient, and customizable terminal environment for anyone working on the Windows command line.

Introducing Git Bash for Windows

Now that you know about the Windows Terminal app, let‘s talk about Git Bash.

Git Bash is essentially a package that provides a Bash emulation shell environment for Git on Windows. It combines:

  • Git – the popular source code management tool
  • Bash – the Bourne Again SHell from Linux/Unix worlds
  • Sh – the POSIX compatible command shell

This allows you to use Linux-style terminal commands while working with the Git source control tools.

Git Bash is very popular with developers on Windows as it provides a familiar Bash experience. The Git for Windows project has tuned it over the years making it lightweight and suitable for daily use.

Prerequisites Before You Begin

Let‘s quickly go over what you need to have installed before we try adding Git Bash to Windows Terminal:

1. Install Windows Terminal

First, you need to have the Windows Terminal application from the Microsoft Store.

  • On Windows 11, it comes pre-installed. Just search for "Terminal" in the start menu to launch it.
  • On Windows 10, download it from the Microsoft Store here.

If this is your very first time using Windows Terminal, you will see just the PowerShell session by default when you launch it.

2. Install Git for Windows

Next, you need to have Git for Windows installed on your machine. This provides the Bash shell configured for Git integration.

Head over to the Git for Windows site and grab the latest installer. I recommend using the default options during setup.

Once you have Git installed, you should be able to run the git command from Command Prompt or PowerShell.

That covers the prerequisites. You are now all set to integrate the Git Bash shell into your shiny new Windows Terminal!

Comparing Windows Terminal, Command Prompt and PowerShell

Before we move on to the integration steps, let‘s do a quick comparison between the Windows Terminal, regular Command Prompt and PowerShell so you understand how they fit together.

Feature Windows Terminal Command Prompt PowerShell
Native app Yes No, built-in No, built-in
Multiple tabs Yes No No
Split panes Yes No No
Themes Yes No No
Customization Full Minimal Minimal
WSL integration Yes Partial Partial
Interactive Developed by Microsoft Developed by Microsoft Developed by Microsoft
Extensibility Medium Low High

While the Command Prompt and PowerShell are built into Windows itself, the Windows Terminal is a new user-installable app from the Microsoft store.

Some key highlights:

  • Windows Terminal allows multiple tabbed shells like Command Prompt, PowerShell, WSL simultaneously. The others are single sessions.
  • It has full theming and GUI customization support. The others have basic config options.
  • Windows Terminal is deeply integrated with WSL allowing Linux terminal usage.
  • PowerShell offers the most extensibility and scripting capabilities.

So in summary:

  • Command Prompt – Basic terminal for legacy apps.
  • PowerShell – Feature-rich for scripting and automation.
  • Windows Terminal – Modern terminal for an enhanced experience.

Now let‘s get into integrating Git Bash with the Windows Terminal app. Exciting times ahead!

Step 1 – Launch Windows Terminal

Let‘s begin by launching the Windows Terminal application on your Windows 11/Windows 10 machine.

You can launch it by:

  • Searching for "Terminal" in the start menu
  • Clicking on the Windows Terminal icon in the taskbar if pinned
  • Opening from the Microsoft Store app

When you first launch it, you will see a PowerShell session opened by default:

Windows Terminal Default View

This is the starting point before we add any customizations or shells like Git Bash.

Step 2 – Open Settings File

Now we need to configure the settings file for Windows Terminal to add our Git Bash profile.

Click on the downwards arrow at the top of the Terminal window and choose Settings from the dropdown menu:

Opening Windows Terminal Settings

This will open up the settings JSON file in your default text editor like Notepad.

The settings file allows configuring all sorts of customizations for Windows Terminal. It has sections for profiles, themes, keybindings, etc.

Step 3 – Understand Profiles

Before adding a new profile, let‘s briefly understand what profiles are in Windows Terminal terminology.

Profiles allow you to configure different shells like PowerShell, Command Prompt, Git Bash, etc in Windows Terminal. You can have multiple profiles.

Each profile can have its own:

  • Shell type (PowerShell, CMD, Git Bash, etc)
  • Background and theming
  • Font style and size
  • Starting directory
  • Environment variables

You switch between profiles using the dropdown at the top of the terminal. It allows opening multiple profiles in tabbed view.

By default, you only have the PowerShell profile configured. We will be adding a new profile for Git Bash.

Step 4 – Add Git Bash Profile

Scroll down to the profiles section in the settings.json file. Let‘s add our Git Bash profile here.

Add the following JSON object within the list array:

{
  "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
  "hidden": false,
  "name": "Git Bash",
  "source": "Windows.Terminal.Wsl"
}

Make sure to add a comma after the previous profile in the array.

The source is set to Windows.Terminal.Wsl for a WSL Bash shell experience.

Your profiles section should now look like:

"profiles":
{
  "defaults":
  {
  },

  "list":
  [
    {
      // Windows PowerShell
    },
    {
      // Command Prompt
    },

    {  
      "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
      "hidden": false,
      "name": "Git Bash",
      "source": "Windows.Terminal.Wsl" 
    }

  ]
} 

This guid helps identify the profile, so make sure it‘s unique in your settings.

Step 5 – Save Settings

We have now added the profile definition. Save the settings file to make it effective.

You can press Ctrl + S to save and close it. Or use the File > Save menu option in your editor.

This will reload the Windows Terminal app with the new configuration.

Step 6 – Open Git Bash Profile

You should now see a new option for the Git Bash profile when clicking on the dropdown menu:

Git Bash in Windows Terminal

Go ahead and open the Git Bash tab!

You will see a Linux-style Bash shell powered by Git for Windows. Try out some Bash commands like:

$ echo Hello from Git Bash!
$ pwd
$ ls
$ git --version

Feels just like Linux, doesn‘t it? But we are running natively within Windows Terminal!

Step 7 – Customize the Profile

You can customize the Git Bash profile with theming colors, choice of shell, initializing directories, etc.

Some examples:

"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}", 
"name": "Git Bash",

// Set a custom directory 
"startingDirectory": "c:\\myprojects",

// Background color 
"background": "#333333",

// Foreground color
"foreground": "#cccccc"

// Use zsh instead of bash
"source": "Windows.Terminal.Zsh" 

// Start as admin 
"runAsAdministrator": true

See the docs here for all available options.

The ability to fully customize profiles is a killer feature in Windows Terminal!

Step 8 – Set as Default Profile

You can set Git Bash to launch by default when opening a new terminal window.

Add the following under defaults in settings.json:

"defaults":
{
  "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}", 
}

Now each time you launch Windows Terminal, it will start with a Git Bash tab.

Step 9 – Open Multiple Git Bash Tabs

You can split the terminal window into multiple panes with individual Git Bash tabs.

Press Alt + Shift + Plus to split vertically or Alt + Shift + Minus to split horizontally.

This allows you to run multiple shells and commands side-by-side:

Multi Pane in Windows Terminal

The split views, tabs and profile switching makes Windows Terminal a very versatile tool!

Troubleshooting Guide

Let‘s go over some common issues you may encounter and how to fix them.

Profile Doesn‘t Appear

Issue – You added the Git Bash profile in settings.json, but don‘t see it in the dropdown menu.

Fix – Try restarting the Windows Terminal app. Also check for errors in the settings file.

Tab Closes Immediately

Issue – When you open the Git Bash tab, it closes immediately.

Fix – Ensure you have Git for Windows installed. Test git --version from the command prompt.

WSL Registration Error

Issue – You see a "Failed to launch WSL: Invalid registration" error.

Fix – Enable WSL on your system using:

wsl --set-default-version 2

Graphics or Icons Appear Corrupted

Issue – You see random characters or blocks instead of proper icons.

Fix – This is a font issue. Install the Cascadia Code PL font for WSL.

Still facing a problem? Ask the helpful community on StackOverflow or GitHub discussions.

Adoption and the Future of Windows Terminal

The Windows Terminal has seen rapid growth since its release.

According to surveys:

  • Over 65% of developers on Windows now use the terminal app daily.
  • It has a 4.8 star rating with over 5500 reviews on the Microsoft Store.
  • The Windows Terminal repository on GitHub has over 46,000 stars.

Microsoft is also actively developing it. Some upcoming features planned are:

  • Tab search
  • Fullscreen support
  • Hyperlinks
  • GUI settings editor
  • Terminal app API

We can expect Windows Terminal to continue improving and becoming the central hub for command line users on Windows.

Integrating Git Bash into it is a huge benefit for developers!

Conclusion

Let‘s summarize everything we learned in this beginner‘s guide:

  • Why the new Windows Terminal and Git Bash are useful
  • How to install the prerequisites
  • Steps to add a Git Bash profile and customize it
  • Configuring multiple tabs and split panes
  • Troubleshooting common issues
  • The growth and future roadmap of the terminal

Integrating Linux-style shells like Git Bash into Windows Terminal gives you the best of both worlds!

I hope this guide was helpful in setting up a seamless Git Bash experience within Windows Terminal on your system.

Let me know if you have any other questions in the comments! I‘m happy to help get you started on this modern terminal.

Have fun!

Scroll to Top