Set git-bash as the default shell in Windows Terminal

Set git-bash as the default shell in Microsoft Windows Terminal.png
Set git-bash as the default shell in Microsoft Windows Terminal.png

Why Git Bash

  • Both Command Prompt (CMD) and Unix (Bash) commands can be run in Git Bash.
  • Small and Fast.

Table Of Contents


Prerequisites

  • Win­dows Ter­mi­nal

    In­stall Win­dows Ter­mi­nal from the Mi­crosoft Store.

2023-01-06_113337.png
2023-01-06_113337.png

  • Choco­latey

    Choco­latey has the largest on­line reg­istry of Win­dows pack­ages.
    Installing Chocolatey

  • Git Bash

    Easy way to in­stall Git Bash via Choco­latey.
choco install git -y

2023-01-05_200058.png
2023-01-05_200058.png

Add Git Bash to Windows Terminal

  • Gen­er­ate a new GUID

    Run the fol­low­ing com­mand in Pow­er­Shell.
[guid]::NewGuid()

2023-01-05_201842.png
2023-01-05_201842.png

  • Added to Windows Terminal profile
Go to Win­dows Ter­mi­nal set­tings via the short­cut key Ctrl + ,

2023-01-05_202346.png
2023-01-05_202346.png

{
    "antialiasingMode": "cleartype",
    "commandline": "%PROGRAMFILES%/Git/usr/bin/bash.exe -i -l",
    "guid": "{f9934442-d71c-40b6-b804-717659fa8640}",
    "historySize": 3000,
    "icon": "%PROGRAMFILES%/Git/mingw64/share/git/git-for-windows.ico",
    "name": "Git-Bash",
    "startingDirectory": "%USERPROFILE%"
}
The GUID f9934442-d71c-40b6-b804-717659fa8640 is the pre­vi­ous com­mand gen­er­ated.
  • Set "Git Bash" as the default terminal

2023-01-10_160726.png
2023-01-10_160726.png

Save the Set­tings.


Reference:

https://winaero.com/generate-new-guid-in-windows-10/
https://walterteng.com/how-to-add-git-bash-to-windows-terminal
Windows Terminal's 設定 Git Bash 和 SSH


Related: