Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode terminal windows - git-bash aliases getting ignored

I've created aliases in c:\Users\user\.bash_profile and in C:\Program Files\Git\etc\profile.d\aliases.sh but both configs getting ignored by VSCode integrated terminal, which is configured to use git bash:

"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",

if I open GitBash itself - aliases works fine

how do I force integrated terminal to respect the configs?

like image 610
godblessstrawberry Avatar asked May 14 '18 08:05

godblessstrawberry


Video Answer


1 Answers

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.

like image 55
Victor S. Avatar answered Sep 21 '22 11:09

Victor S.