# Launching Git Bash in Mintty, ConEmu, VS Code’s Terminal, and Other Terminal Emulators Updated  2021-December-14

## News

2022-March-22  As of today, this evolving⁠[1] article has been on the web for 1 year.🎂

Git Bash is a Windows command-line shell that is packaged with Git for Windows. It emulates the bash shell that is familiar to nix-nux users.⁠[2][3] To learn about Git Bash, see Infinite Ink’s Git Bash Is My Preferred Windows Shell and #git-⁠bash Portal.

 💡 Git Bash is useful even if you do not use git.

To interact⁠[4] with Git Bash and command-line shells in general, humans use a terminal emulator. A terminal emulator can be either a standalone app, for example ConEmu, or integrated into another app, for example Visual Studio Code’s integrated terminal. To view a list of standalone terminal emultors, see Wikipedia’s List of terminal emulators.

 ℹ Terminal emulators are also known as terminals and consoles.

## About bin/bash.exe versus usr/bin/bash.exe

In the sections below, sometimes bin/bash.exe is used and sometimes usr/bin/bash.exe is used. Both of these launch Git Bash and the only difference — as far as I can tell — is that bin/bash.exe executes usr/bin/bash.exe as a login shell.

## Launch Git Bash in Git Bash’s default terminal emulator (Mintty)

If you install Git Bash with the default Git for Windows set-up options, you will easily be able to launch Git Bash in the Mintty terminal emulator from Windows File Explorer or from a Windows Desktop shortcut.

### Launch via File Explorer

In Windows File Explorer, right-click any folder and choose Git Bash Here in the pop-up context menu. This launches Git Bash in Mintty with the right-clicked folder as the working directory.

### Launch via a desktop shortcut

If you double click the Git Bash shortcut on your Windows Desktop, it will launch Git Bash in Mintty with your home directory (~) as the working directory.

If you right-click on the default Desktop Git Bash shortcut and choose Properties, you will see something like the following.

Target: "C:\Program Files\Git\git-bash.exe" --cd-to-home

Start in: %HOMEDRIVE%%HOMEPATH%

You can change these shortcut properties if you like. For example, to start in the C:\ directory, use this:

Target: "C:\Program Files\Git\git-bash.exe" --cd=C:\

To start in a directory specified by an environment variable, use something like this:

Target: "C:\Program Files\Git\git-bash.exe" --cd=%INFINITEINKROOT%

Some of git-bash.exe's command-line options, such as --cd, are discussed in superuser.com/questions/1104567/how-can-i-find-out-the-command-line-options-for-git-bash-exe.

 ‼ git-bash.exe runs mintty.exe. To launch Git Bash in a non-Mintty terminal, use git-⁠cmd.exe, examples of which are in the next two sections.

## Launch Git Bash in the ConEmu terminal emulator

The easiest way to set up ConEmu to launch Git Bash is to do the following in this order:

1. Install Git for Windows, which includes Git Bash.

2. Install ConEmu.

If you install these apps in this order, the following will automatically be one of the options in ConEmu’s Choose your startup task: list.

{Bash::Git bash}

Then all you have to do is choose this option and it will just work.⁠👏

If you need to manually add a ConEmu startup task for Git Bash, follow the instructions at conemu.github.io/en/GitForWindows.html. In March 2021, this command is recommended:

git-cmd.exe --no-cd --command=usr/bin/bash.exe -l -i
^^^^^^^                       ^^^^^^^
Note                          Note

## Launch Git Bash in Visual Studio Code’s integrated terminal emulator

To use Git Bash in VS Code's integrated terminal emulator, do the following two steps.

1. Follow the Git Bash instructions at code.visualstudio.com/docs/editor/integrated-terminal. In March 2021, the VS Code documentation suggested including this⁠[5] in your settings.json:

"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\git-cmd.exe",
"terminal.integrated.shellArgs.windows": [
"--command=usr/bin/bash.exe",
"-l",
"-i"
]

2. If the Backspace key does not work, set your Git Bash TERM environment variable to cygwin or xterm. How to do this is discussed in Infinite Ink’s Git Bash Is My Preferred Windows Shell in the ~/.bash_profile section.

## Launch Git Bash in IntelliJ IDEA’s integrated terminal emulator

To learn about IntelliJ IDEA's integrated terminal emulator, see www.jetbrains.com/help/idea/settings-tools-terminal.html. On that page, there are seven “Shell path” examples, but unfortunately Git Bash is not one of the examples. The following is suggested for Cygwin:

"C:\cygwin\bin\bash.exe" --login -i

Since Git Bash is similar to Cygwin, I tried this:

"C:\Program Files\Git\usr\bin\bash.exe" --login -i

And it worked!⁠[5]

## Launch Git Bash in Vim’s integrated terminal emulator

In Vim v8.1 and newer, you can launch an integrated terminal emulator with the :terminal or :term command. On my Windows devices, these equivalent commands launch the old Windows shell called CMD (also known as cmd.exe and “Command Prompt”). To launch Git Bash instead of CMD, typing this sequence within Vim works for me.

Esc
:term bash -li

To exit this integrated Vim terminal emulator, I type the following sequence of commands.

exit
:q

 ℹ This :term bash -li command works because Git Bash’s bash.exe is the first bash on my path.Vim’s default is to open the terminal window above the current buffer. To open it below, put this in your vimrc file: set splitbelowTo prevent Vim from displaying a warning that Terminal is not fully functional, set Git Bash’s TERM environment variable to cygwin or xterm.

## Launch Git Bash in the Windows Terminal terminal emulator

To use Git Bash with Microsoft’s Windows Terminal, which is also known as wt.exe, follow the instructions at github.com/microsoft/terminal/blob/main/doc/user-docs/ThirdPartyToolProfiles.md. In April 2021, this⁠[5] JSON fragment is suggested:

{
"name": "Git Bash",
"commandline": "C:\\Program Files\\Git\\bin\\bash.exe -li",
"icon": "C:\\Program Files\\Git\\mingw64\\share\\git\\git-for-windows.ico",
"startingDirectory": "%USERPROFILE%"
}

You may want to change the highlighted line above to this:

"commandline": "C:\\Program Files\\Git\\usr\\bin\\bash.exe -li",
^^^^^
Note

This may be better because…

• bin\bash.exe calls usr\bin\bash.exe and it should use less memory to directly call usr\bin\bash.exe;

• and reasons discussed in conemu.github.io/en/GitForWindows.html.

On the other hand, it may or may not be better because of reasons discussed in…

For more about this, see Microsoft’s Windows Terminal General Profile Settings. If you have thoughts about what is the best way to launch Git Bash in Windows Terminal, please comment below.⁠

For more about Git Bash, see Infinite Ink’s…

## Endnotes

1. Many Infinite Ink articles, including this one, are evergreen and regularly updated.
2. Git Bash uses MSYS2 (Minimal SYStem 2) and MinGW (Minimalist GNU for Windows) to do this emulation.
3. Git Bash is sometimes called “msys bash.”
4. When you launch bash.exe with the -i command-line option, it means you want to be able to interact with the Bash shell.
5. Assuming Git For Windows is installed in Git Bash’s default install directory (C:\Program Files\Git\).

## Comments and questions 📝 🤔 👎 👍

Your public comment or question might immediately improve this page or help me to (eventually) improve this page.