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

In Git for Windows, this message is emitted during execution of the file etc/profile.d/git-prompt.sh, if the shell is not Bash.

git-prompt.sh sources git-completion.bash without looking at the shell name. That file checks that it is not run by Bash, emits that warning message and exits.

Here is the link to the respective code: https://github.com/git/git/blob/master/contrib/completion/git-completion.bash#L3509

You should look inside git-completion.zsh located in the same directory near this file and follow installation instructions provided in the comments in the beginning:

# 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)

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

  1. The easiest way to get auto-completion working is to install it through Homebrew (it will work for zsh as well as bash.):
brew install bash-completion
  1. 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
  1. Save the file and do a source ~/.zshrc and you will be good

For me, I simply had copied over the contents of ~/.bash_profile to ~/.zprofilewhen migrating to zsh. I simply removed this line which was the root cause of the warning message:

source ~/.profile

Tags:

Git

Zsh

Oh My Zsh