原因:直接安装的git 缺少配置文件
解决步骤:
1、下载配置文件
cd ~/
git clone https://github.com/git/git.git
2、复制git配置文件
cp ~/git/contrib/completion/git-completion.bash ~/.git-completion.bash
注:如果git pull速度过慢,可以忽略以上两步,直接下载单独的文件
cd ~/ wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash mv ~/git-completion.bash ~/.git-completion.bash
3、把这句话生效的命令添加到 .bashrc 里
echo "source ~/.git-completion.bash" >> ~/.bashrc
4、重新加载 .bashrc 文件
sourch ~/.bashrc