MENU

Catalog

Zsh终端代理设置

February 14, 2021 • 工具,macOS

主要每次使用git拉取代码的时候太龟速了,所以整理下zsh下配置代理的方式。

配置

方式1
可在用户根目录cd ~下配置,.zshrc 或者 .bashrc根据使用的终端自行选择.

alias export https_proxy=https://localhost:port
alias export http_proxy=http://localhost:port
alias export all_proxy=socks5://localhost:port

方式2(推荐)
可在用户根目录cd ~下配置,.zshrc,

# where proxy
proxy () {
  export all_proxy=socks5://localhost:port
  echo "All Proxy on"
}

# where noproxy
noproxy () {
  unset all_proxy
  echo "All Proxy off"
}

配置完成后可使用proxy&noproxy 开启&关闭

验证

curl cip.cc
开启前
FV0f.png

开启后
JxmM.png