Using Git Bash with the Windows Terminal

Sascha Corti
2 min readNov 7, 2019

--

This short tutorial shows how to add the Git Bash shell that is part of Git for Windows to the Windows Terminal, make it the default shell, add it’s color profile and add a “Windows Terminal Here” entry to the Windows Explorer context menu…

First, make sure Git for Windows and the Windows Terminal are installed. If you use Chocolatey, you can simply run the following command from and elevated prompt:

choco install git

To get to the settings of the Windows Terminal, select the down-arrow in the tab bar and the “Settings” — or press Ctrl+,

In settings, add a new element to the “Profiles” section:

"profiles" :
[
{
"acrylicOpacity" : 0.75,
"background" : "#000000",
"closeOnExit" : true,
"colorScheme" : "Campbell",
"commandline" : "\"%PROGRAMFILES%\\git\\bin\\bash.exe\" --login -i -l",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Consolas",
"fontSize" : 10,
"guid" : "{00000000-0000-0000-0000-000000012345}",
"historySize" : 9001,
"icon" : "%PROGRAMFILES%\\git\\mingw64\\share\\git\\git-for-windows.ico",
"name" : "Git Bash",
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"useAcrylic" : true
},
...

Make sure to generate (change the existing) guid to be unique among your profiles. If you want Git Bash to be your default startup-console, set the defaultProfile in globals accordingly:

"globals" : 
{
"defaultProfile" : "{00000000-0000-0000-0000-000000012345}",

If you want the Git Bash color scheme in Windows Terminal, add the following to:

"schemes" : 
[
{
"background" : "#000000",
"black" : "#0C0C0C",
"blue" : "#6060ff",
"brightBlack" : "#767676",
"brightBlue" : "#3B78FF",
"brightCyan" : "#61D6D6",
"brightGreen" : "#16C60C",
"brightPurple" : "#B4009E",
"brightRed" : "#E74856",
"brightWhite" : "#F2F2F2",
"brightYellow" : "#F9F1A5",
"cyan" : "#3A96DD",
"foreground" : "#bfbfbf",
"green" : "#00a400",
"name" : "GitBash",
"purple" : "#bf00bf",
"red" : "#bf0000",
"white" : "#ffffff",
"yellow" : "#bfbf00",
"grey" : "#bfbfbf"
},
...

…and change “colorScheme” in the profile to “GitBash”:

...
"colorScheme" : "GitBash",
...

Finally, to add a right-click context menu “Windows Terminal Here” to Windows Explorer, create a new file with “.reg” extension containing:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\windowsterminal]
@="Windows Terminal Here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\windowsterminal\command]
@="\"C:\\Users\\{USERNAME}\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe\""

Replace {USERNAME} with the correct folder name in C:\Users\ on your machine.

Merge the .reg file with your registry by double-clicking it.

--

--

Sascha Corti

Software Development Engineer for Microsoft in Switzerland. Focus on the Internet of Things, A.I. and x-platform app development. EV geek and gamer with a life.