命令行设置代理

638 阅读1分钟

临时代理

Windows临时代理

# HTTP
set http_proxy=http://127.0.0.1:8118
set https_proxy=http://127.0.0.1:8118

# SCOKS
set http_proxy=socks5://127.0.0.1:1080
set https_proxy=socks5://127.0.0.1:1080

# 取消 socks类似
set http_proxy=
set https_proxy=

Linux

# HTTP 
export http_proxy=http://127.0.0.1:1080
export https_proxy=http://127.0.0.1:1080

# SOCKS
export http_proxy=socks5://127.0.0.1:1080
export https_proxy=socks5://127.0.0.1:1080

# 全部
export ALL_PROXY=socks5://127.0.0.1:1080

永久代理

将临时代理配置写入 ~/.profile~/.bashrc~/.zshrc 文件中

Git 代理

代理格式 [protocol://][user[:password]@]proxyhost[:port]

参考 git-scm.com/docs/git-co…

# HTTP
git config --global http.proxy http://127.0.0.1:8118
git config --global https.proxy http://127.0.0.1:8118


# SOCKS5
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080


# 取消
git config --global --unset http.proxy
git config --global --unset https.proxy

参考

  1. Win/Linux 命令行、终端和 Git 代理设置