Homebrew install: Failed during: git fetch origin master:refs/remotes/origin/master -n --depth=1

After a few hours of research and brute force I learned the issue was due to git not being configured properly. Some articles suggested downgrading your git or reinstalling all together. However, I resolved the issue just by adding the following

git config --global user.email [email protected]

Then remove the cellar and homebrew directories from /usr/local and re-try the installation.


  1. create a file named run.sh
  2. add this:
rm -rf /usr/local/bin/brew
rm -rf /usr/local/share/doc/homebrew
rm -rf /usr/local/share/man/man1/brew.1
rm -rf /usr/local/share/zsh/site-functions/_brew
rm -rf /usr/local/etc/bash_completion.d/brew
rm -rf /usr/local/Homebrew
  1. run the file using sh run.sh

Or, just run all these commands manually one by one.