Skip to content

Windows Terminal - Git Bash and Environment Settings ​

This is a short note of how I set up my Windows PC development environment. Below is the Straight To The Code Snippets without any long comments and explanations.

Windows Terminal - Git Bash ​

You should have Git installed on your Windows PC. If you haven't, you can download it from Git SCM.

  1. Open Microsoft Store
  2. Search for Windows Terminal
  3. Click get whether it's the Windows Terminal or Windows Terminal Preview version.

Windows Terminal in Microsoft Store

  1. Open Windows Terminal Settings
  2. From the sidebar, enter Startup and change the Default Profile to Git Bash.
  3. Optional: change Starting Directory to . so the Windows Terminal started where it is invoked.
  4. And you're done! You can now open Windows Terminal with Git Bash as the default shell. You can also customize the terminal appearance and behavior as you like in the setting.

πŸ’‘ Tip

For starting in current working directory, you can click on the address bar of Windows Explorer, type wt and press Enter. It will open Windows Terminal in the current directory just like what you set in the Starting Directory setting.

Inshellisense Plugin ​

Reference: Inshellisense

Node.js Version Requirement

As of writing, Inshellisense requires Node.js 20.X, 18.X, 16.X (16.6.0 >=) to work. Make sure you have suitable Node.js installed on your Windows PC. Download it from Node.js Download.

Installation ​

bash
npm install -g @microsoft/inshellisense

Quick Start

ActionCommand
Startis
Stopexit
Check If Inside Inshellisense Sessionis -c

Setting in Windows Terminal ​

  1. After installed inshellisense, open Windows Terminal Setting.
  2. From sidebar, in the section Profiles, click Git Bash
  3. Change the Command Line to:
    bash
    path/to/bash.exe -i -l -c "is -s bash"
    bash
    C:/Program Files/Git/bin/bash.exe -i -l -c "is -s bash"
  4. Restart Windows Terminal
  5. Done! Inshellisense is now automatically started when you open Windows Terminal with Git Bash.

Inshellisense in Windows Terminal

PATH Setting ​

If you want to call some executables from the command line or Run dialog (Win + R), you can add the path to the executable to the PATH environment variable. This setting is very useful when I have multiple python versions installed on my Windows PC, so I can call python310, python311, etc. from the command line.

  1. Search in windows "Environment variables"
  2. Click environment variables
  3. On the upper section (user variables), double click Path
  4. Enter the folder where exe file is in
  5. Example, C:\Users\kevin\AppData\Local\Programs\Microsoft VS Code Insiders\bin for code-insisders.exe file.
  6. Done! Now you can call the executable from the command line just by typing the executable name (without the .exe extension).

Windows Environment Variable - Path

Aliases Creation ​

It is so infuriating when we need to type long command, such as when I want to invoke the code-insiders . for opening the current directory in Visual Studio Code Insiders. To make it easier, let's create an alias for the command.

  1. Open .bashrc file in your user directory, usually it is in C:\Users\<your_user_name>\.bashrc.
  2. You also open it from terminal by typing notepad ~/.bashrc, code-insiders ~/.bashrc, or other text editor you have.
  3. Create aliases as many as you like, below is the usual aliases I created:
    bash
    # Command Aliases
    alias codi='code-insiders'
    alias poetry='python311 -m poetry'
    alias exp='explorer .'
    alias ave='source ./env/Scripts/activate'
    alias avve='source ./.venv/Scripts/activate'
    # Directory Aliases
    alias htdocs='cd d:/xampp/htdocs'
  4. Save the file
  5. Restart the terminal.
  6. Done! Now you can use the aliases you created.

Kevin Daffa Arrahman | Built with VitePress