Win10: VS Code integrated bash not loading ~/.bash_profile

.bash-profilevisual-studio-code

As the title suggest, when I start my git bash regularly it loads my ~/.bash_profile but the one integrated in my VS Code is not loading it.

Where can I put .bash_profile so that it would also load in VS Code?

Edit: here's my vs code with the terminal
vs code

and here's my git bash git bash

I want to load the same .bash_profile file in my vs code terminal that is loading on my git bash, so that it would show the branch name and also have aliases i defined there.

Best Answer

Turns out, that it had to do in how the terminal is started. The git bash one (in its own window) is using the login to start and hence reads .bash_profile.

The one in vs code is started not in the login way (sorry, I'm not well versed in this), and reads .bashrc instead of .bash_profile.

My solution was to move all the stuff I kept in .bash_profile and move it to .bashrc and add the following line to .bash_profile:

if [ -f ~/.bashrc ]; then . ~/.bashrc; fi

which loads the .bashrc contents when starting in the login way.

Related Question