-bash: __git_ps1: command not found

后端 未结 6 944
灰色年华
灰色年华 2020-12-02 10:42

I tried to install Ruby 2.0. My command line urped and now looks like the following:

-bash: __git_ps1: command not found
[11:58:28][whatever@whatever ~]$ 
         


        
6条回答
  •  醉梦人生
    2020-12-02 10:48

    Quoting from /usr/lib/git-core/git-sh-prompt:

    # This script allows you to see repository status in your prompt.
    #
    # To enable:
    #
    #    1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
    #    2) Add the following line to your .bashrc/.zshrc:
    #        source ~/.git-prompt.sh
    #    3a) Change your PS1 to call __git_ps1 as
    #        command-substitution:
    #        Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
    #        ZSH:  setopt PROMPT_SUBST ; PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ '
    #        the optional argument will be used as format string.
    #    3b) Alternatively, for a slightly faster prompt, __git_ps1 can
    #        be used for PROMPT_COMMAND in Bash or for precmd() in Zsh
    #        with two parameters, 
     and , which are strings
    #        you would put in $PS1 before and after the status string
    #        generated by the git-prompt machinery.  e.g.
    #        Bash: PROMPT_COMMAND='__git_ps1 "\u@\h:\w" "\\\$ "'
    #          will show username, at-sign, host, colon, cwd, then
    #          various status string, followed by dollar and SP, as
    #          your prompt.
    #        ZSH:  precmd () { __git_ps1 "%n" ":%~$ " "|%s" }
    #          will show username, pipe, then various status string,
    #          followed by colon, cwd, dollar and SP, as your prompt.
    #        Optionally, you can supply a third argument with a printf
    #        format string to finetune the output of the branch status
    

    Following these steps should fix your issue!!

提交回复
热议问题