1.下载git-prompt.sh
https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
2.拷贝到/etc/profile.d/目录下,替换原来旧的
3.在/etc/bash.bashrc文件中末尾增加如下内容
source /etc/profile.d/.git-prompt.sh
4.解决问题