Updating Brew When It's Blocked on Mac
Running
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
When installing with this command, it reported that GitHub was inaccessible and brew could not be downloaded.
So the only option was
git clone git://mirrors.tuna.tsinghua.edu.cn/homebrew.git (or git clone http://mirrors.ustc.edu.cn/homebrew.git)
Download, then copy into the /usr/local folder.
After trying
git remote set-url origin http://mirrors.ustc.edu.cn/homebrew.git
and then running brew update, it still said GitHub was inaccessible—quite strange.
I thought of two approaches: one was to modify brew's scripts to force a specific setting, but that was too much trouble.
So in the end I used ShadowsocksX-NG, connected directly to the server, opened port 1087 as an HTTP proxy, and in the terminal used:
export https_proxy=http://127.0.0.1:1087
Then brew succeeded.