本文介绍了警告:不建议使用此脚本,请参阅git-completion.zsh的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是oh-my-zsh,每次打开终端时都会收到此错误:

I'm using oh-my-zsh and I get this error every time I open terminal:

WARNING: this script is deprecated, please see git-completion.zsh

有什么解决办法吗?

推荐答案

可能看起来很愚蠢,但是请确保您获取~/.zshrc文件的源文件(如果文件不存在,则创建一个文件).在OSX上,我完全忘记了我已切换到zsh,并得到了您提到的错误,因为我在做source ~/.bashrc

Might seems silly, but make sure that you source your ~/.zshrc file (create one if it does not exists). On OSX I completely forgot that I had switched to zsh, and got the error you mentioned because I was doing source ~/.bashrc

获得自动完成功能最简单的方法是通过 Homebrew brew install bash-completion一起安装(它将起作用用于zsh和bash),然后将其放入您的~/.zshrc:

The easiest way to get auto-completion working is to install it through Homebrew with brew install bash-completion (it will work for zsh as well as bash) and then put this into your ~/.zshrc:

# auto-completion
if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then
  . /opt/local/etc/profile.d/bash_completion.sh
fi

保存文件并执行source ~/.zshrc,您会很好

Save the file and do a source ~/.zshrc and you will be good

这篇关于警告:不建议使用此脚本,请参阅git-completion.zsh的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 21:45