Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lion OS - brew update returns "Failure while executing..."

I am trying to update my brew, when I set

brew update

I get this error:

error: Your local changes to the following files would be overwritten by merge:
    Library/Formula/imagemagick.rb
Please, commit your changes or stash them before you can merge.
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

or

error: The requested URL returned error: 403 while accessing https://github.com/mxcl/homebrew/info/refs
fatal: HTTP request failed
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

What's the problem with Git? How to update brew if this way doesn't work?

like image 765
user984621 Avatar asked Apr 15 '13 14:04

user984621


1 Answers

This is caused by an old bug in the update code that has long since been fixed. However, the nature of the bug requires that you do the following:

cd $(brew --repository)
git reset --hard FETCH_HEAD

If brew doctor still complains about uncommitted modifications, also run this command:

cd $(brew --repository)    
git clean -fd
like image 74
Eric Wu Avatar answered Oct 12 '22 02:10

Eric Wu