"brew update" fails with: fatal: git-write-tree: error building trees

Post date: Jan 18, 2016 8:28:08 PM

I ran "brew update" and received the error message "fails with: fatal: git-write-tree: error building trees ..." The issue is resolved by the following steps:

  1. Go to /usr/local and run
  1. Now you can run brew command
    1. > brew update
    2. > brew upgrade
    3. > brew install your_package

Here is what I tried on my terminal

      1. > git reset --hard origin/master; git checkout --force master
> cd /usr/local/
> git status
On branch master
Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git add <file>..." to mark resolution)

both modified: Library/Formula/python.rb

no changes added to commit (use "git add" and/or "git commit -a")
> git reset --hard origin/master; git checkout --force master
HEAD is now at ef28579 ipfs: update 0.3.10 bottle.
Already on 'master'
> git status
On branch master
nothing to commit, working directory clean
> brew update
> brew upgrade
> brew install <whatever_package>