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

git, homebrew, osx-lion, osx-mountain-lion

Solution

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

Problem

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?

Original source