Powershell

查看代理

1
netsh winhttp show proxy

设置代理

1
2
3
# 设置仅本次有效
$env:HTTP_PROXY="http://127.0.0.1:10809"
$env:HTTPS_PROXY="https://127.0.0.1:10809"

或者

1
2
3
4
5
# 需要管理员权限
# 否则 Error writing proxy settings. (5) Access is denied.
netsh winhttp set proxy 127.0.0.1:10809
# or
netsh winhttp import proxy source=ie

取消代理

1
netsh winhttp reset proxy

Git bash

设置代理

1
2
3
4
5
6
# 设置永久有效
git config --global https.proxy http://127.0.0.1:10809
git config --global https.proxy https://127.0.0.1:10809
git config --global http.proxy 'socks5://127.0.0.1:10808'
git config --global https.proxy 'socks5://127.0.0.1:10808'
git config --global --list #查询代理设置

CMD

设置代理

1
2
3
# 设置仅本次有效
$env:HTTP_PROXY="http://127.0.0.1:10809"
$env:HTTPS_PROXY="https://127.0.0.1:10809"

Mac Proxy 命令

1
2
3
// 打开.zshrc
alias proxy='export all_proxy=http://127.0.0.1:1087'
alias unproxy='export unset all_proxy'