1. git代理
1.1 查看git代理
git config --global -l
1.2 设置git代理
1.2.1命令行设置
//设置全局代理
//http
git config --global https.proxy http://127.0.0.1:1080
//https
git config --global https.proxy https://127.0.0.1:1080
//使用socks5代理的 例如ss,ssr 1080是windows下ss的默认代理端口,mac下不同,或者有自定义的,根据自己的改
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080
//只对github.com使用代理,其他仓库不走代理
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
git config --global https.https://github.com.proxy socks5://127.0.0.1:1080
1.2.2 修改~/.gitconfig
配置文件(永久性)
[http]
proxy = socks5://127.0.0.1:1080
[https]
proxy = socks5://127.0.0.1:1080
1.3 取消git代理
1.3.1 取消仅对https://github.com设置的代理
git config --global --unset http.https://github.com.proxy
git config --global --unset https.https://github.com.proxy
1.3.2 取消git对所有网站的代理
git config --global --unset http.proxy
git config --global --unset https.proxy
2. 终端代理
2.1 命令行查看终端代理
env|grep -I proxy
2.2 命令行设置终端代理
export https_proxy=socks5://127.0.0.1:1080 http_proxy=socks5://127.0.0.1:1080 all_proxy=socks5://127.0.0.1:1080
此外还有ftp_proxy
,no_proxy
等设置
2.3 命令行取消终端代理
$ unset http_proxy && unset ftp_proxy && unset all_proxy && unset https_proxy && unset no_proxy