Today I faced something weird:
byte@lovegood~$ brew update error: RPC failed; result=22, HTTP code = 400 fatal: The remote end hung up unexpectedly Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master
I ran the brew doctor to find out my git version was outdated. Turns out you need “Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.” I had 22.214.171.124! Upgraded it to 126.96.36.199 now and all is well.