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

Solution 1:

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.

Solution 2:

You can try adding to the settings: "terminal.integrated.shellArgs.windows": ["-l"],


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

Solution 3:

Using WSL (Ubuntu 16.04), I had to add the following option to my settings.json in VS Code in order to run the shell as a login shell:

"terminal.integrated.shellArgs.linux": ["-l"]

Solution 4:

An alternative method to the accepted answer:

In your root directory add a file .bashrc with the following code:

source <rootdirectory>/.bash_profile

Where you replace with your own root.

For example that could be C:/Users/domkj/.bash_profile