zia*_*war 19 git zsh oh-my-zsh
我正在使用oh-my-zsh,每次打开终端时都会收到此错误:
WARNING: this script is deprecated, please see git-completion.zsh
Run Code Online (Sandbox Code Playgroud)
那有什么解决方案吗?
kuz*_*zyn 11
可能看起来很傻,但请确保您的~/.zshrc文件来源(如果它不存在则创建一个).在OSX上我完全忘记了我已经切换到zsh,并且因为我正在做而得到了你提到的错误source ~/.bashrc
获得自动完成工作的最简单方法就是通过安装它家酿用brew install bash-completion(它会为zsh的工作,以及bash)的,然后把这个到你~/.zshrc:
# auto-completion
if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then
. /opt/local/etc/profile.d/bash_completion.sh
fi
Run Code Online (Sandbox Code Playgroud)
保存文件并做一个source ~/.zshrc,你会很好
etc/profile.d/git-prompt.sh在 Windows 版 Git 中,如果 shell 不是 Bash,则在文件执行期间会发出此消息。
git-prompt.shgit-completion.bash无需查看 shell 名称即可获取来源。该文件检查它是否不是由 Bash 运行,发出该警告消息并退出。
以下是相应代码的链接: https://github.com/git/git/blob/master/contrib/completion/git-completion.bash#L3509
您应该查看位于此文件附近同一目录中的 git-completion.zsh 并按照开头注释中提供的安装说明进行操作:
# The recommended way to install this script is to make a copy of it as a
# file named '_git' inside any directory in your fpath.
#
# For example, create a directory '~/.zsh/', copy this file to '~/.zsh/_git',
# and then add the following to your ~/.zshrc file:
#
# fpath=(~/.zsh $fpath)
Run Code Online (Sandbox Code Playgroud)
在控制台中输入以下内容:
curl https://github.com/git/git/raw/master/contrib/completion/git-completion.zsh -OL
将此添加到您的一个.profile/ .bashrc/中.zshrc:
source ~/git-completion.zsh
对我来说,我只是在迁移到 zsh 时复制了~/.bash_profileto的内容~/.zprofile。我只是删除了这一行,这是警告消息的根本原因:
source ~/.profile
| 归档时间: |
|
| 查看次数: |
6642 次 |
| 最近记录: |