(Mac) -bash: __git_ps1: command not found

后端 未结 19 1987
感动是毒
感动是毒 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条回答
  •  一向
    一向 (楼主)
    2020-11-30 16:54

    High Sierra clean solution with colors !

    No downloads. No brew. No Xcode

    Just add it to your ~/.bashrc or ~/.bash_profile

    export CLICOLOR=1
    [ -f /Library/Developer/CommandLineTools/usr/share/git-core/git-prompt.sh ] && . /Library/Developer/CommandLineTools/usr/share/git-core/git-prompt.sh
    export GIT_PS1_SHOWCOLORHINTS=1
    export GIT_PS1_SHOWDIRTYSTATE=1
    export GIT_PS1_SHOWUPSTREAM="auto"
    PROMPT_COMMAND='__git_ps1 "\h:\W \u" "\\\$ "'
    

提交回复
热议问题