VSCode terminal windows - git-bash aliases getting ignored

The solution using the "--login" and "-i" shell arguments did not work for me. What did work was using the bash "-rcfile" shell argument, like this, in my settings file:

"terminal.integrated.shellArgs.windows": [ "-rcfile", "c:\Users\\.bash_profile", ],

... where <userid> is my Windows userid and the alias commands are in a file called ".bash_profile" that is located in c:\Users\<userid>


I simply switched to my root user directory c:\Users\user then ran source .bashrc. This did the trick on my machine, hope it helps.


You can try adding to the settings:

// The command line arguments to use when on the Windows terminal.
"terminal.integrated.shellArgs.windows": [
    "--login", "-i"
],

-i - force the shell to run interactively.

--login - make this shell act as if it had been directly invoked by login. When Bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

When invoked as an interactive shell with the name sh, Bash looks for the variable ENV, expands its value if it is defined, and uses the expanded value as the name of a file to read and execute. Since a shell invoked as sh does not attempt to read and execute commands from any other startup files, the --rcfile option has no effect. A non-interactive shell invoked with the name sh does not attempt to read any other startup files.

Read more.


As an alternative you can use the .bashrc file instead of .bash_profile.