Not sure if this problem is related to upgrading to MacOs Sierra, but since that moment this error occurs when I run \'brew update\'
→ brew update
Checking
Nothing really worked for me, I had to resort to uninstalling and reinstalling Brew:
# change to home directory to avoid other errors later
cd ~
# uninstall brew
rm -rf /usr/local/Cellar /usr/local/.git && cd ~ && brew cleanup
# reinstall brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"