mac下brew和git速度很慢,走代理最容易,避免很多不必要的操作。
socks代理
brew 和git走socks代理
1. 一次設置,設置zshrc或者bashrc
brew如果需要走代理,需要設置代理變量:
echo export ALL_PROXY=socks5://127.0.0.1:1086 >> ~/.bash_profile
如果使用zsh,則使用下面的命令:
echo export ALL_PROXY=socks5://127.0.0.1:1086 >> ~/.zshrc
然後開啓一個新的終端窗口,運行brew命令即可。
2.每次新的終端都設置一次
export ALL_PROXY=socks5://127.0.0.1:1086
http代理
git 走http代理
如果SOCKS代理存在問題,請您嘗試HTTP代理:
git config --global http.proxy 'http://127.0.0.1:1087'
git config --global https.proxy 'http://127.0.0.1:1087'
經過測試,
mac下設置export,brew走socks代理,git走http代理。
ubuntu下git config …,再git clone http。