Vscode: Integrated terminal can't find __git_ps1

Created on 19 Jul 2016  路  3Comments  路  Source: microsoft/vscode

  • VSCode Version: 1.3.1
  • OS Version: OS X El Capitan (10.11.6)

Steps to Reproduce:

  1. Add the following to ~/.bash_profile
# Enable tab completion
source ~/git-completion.bash
# colors!
green="\[\033[0;32m\]"
blue="\[\033[0;34m\]"
purple="\[\033[0;35m\]"
reset="\[\033[0m\]"
# Change command prompt
source ~/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
# '\u' adds the name of the current user to the prompt
# '\$(__git_ps1)' adds git-related stuff
# '\W' adds the name of the current directory
export PS1="$purple\u$green\$(__git_ps1)$blue \W $ $reset"
  1. Open integrated terminal. Every line is now prefixed with this error
    screen shot 2016-07-19 at 9 09 07 am

Note, the system terminal does not have this error and properly displays __git_ps1
screen shot 2016-07-19 at 9 11 12 am

integrated-terminal

Most helpful comment

By default the VS Code integrated terminal does not run as a login shell and therefore does not run ~/.bash_profile, have you got this in your settings.json?

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

All 3 comments

By default the VS Code integrated terminal does not run as a login shell and therefore does not run ~/.bash_profile, have you got this in your settings.json?

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

That fix works! Thanks @Tyriar.

Good to hear :smiley:

Was this page helpful?
0 / 5 - 0 ratings