Mac下解决git没有自动补全

时间:2024-03-11 22:40:55

1. Install homebrew

2. Install Git and bash-completion: brew install git bash-completion (Note: If this install fails with a 404 error, and you already have git installed, just remove the git part of this brew install)

在我电脑上已经安装了git,现在只需要安装bash-completion即可,执行如下命令

uxiaolei@duxiaoleideMacBook-Pro:~$brew install bash-completion
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (bazelbuild/tap).
==> Updated Formulae
bazelbuild/tap/bazel

==> Downloading https://homebrew.bintray.com/bottles/bash-completion-1.3_3.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring bash-completion-1.3_3.high_sierra.bottle.tar.gz
==> Caveats
Add the following line to your ~/.bash_profile:
  [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary