Search code examples
rubygitmacoshomebrewosx-elcapitan

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


I ran the following command on terminal (Mac El Capitan)

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

and got the following error message:

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

Additionally tried:

sudo chown $(whoami):admin /usr/local && sudo chown -R $(whoami):admin /usr/local

then the two commands above.

Any idea how to install Homebrew?

brew is not recognized and ruby version 2.0.0, git version 2.7.4


Solution

  • 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.