(Mac) -bash: __git_ps1: command not found

后端 未结 19 2058
感动是毒
感动是毒 2020-11-30 16:20

I\'m trying to change my command promt in terminal. I keep getting the error:

-bash: __git_ps1: command not found

I\'ve tried it just by typing

19条回答
  •  旧时难觅i
    2020-11-30 16:52

    For git, there are /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh. And please look /etc/bashrc_Apple_Terminal too.

    So, I put these in ~/.bash_profile:

    if [ -f /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh ]; then
      . /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh
      export GIT_PS1_SHOWCOLORHINTS=1
      export GIT_PS1_SHOWDIRTYSTATE=1
      PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND; }__git_ps1 '\u:\w' '\\\$ '"
    fi
    

提交回复
热议问题