给 Windows 的终端配置代理

参考博客

直接执行命令是只对当前终端进行代理,不影响环境,如果要设置永久代理,需要写入~/.bashrc文件中

#cmd
set http_proxy=http://127.0.0.1:1080
set https_proxy=http://127.0.0.1:1080
或者
set ALL_PROXY=http://127.0.0.1:1080

#git bash,git bash可以通过在~路径下新建.bashrc,将下面两条命令写入,然后source ~/.bashrc,就可以实现永久的设置代理
export http_proxy=http://127.0.0.1:1080
export https_proxy=http://127.0.0.1:1080
或者
export ALL_PROXY=http://127.0.0.1:1080

或者直接使用alias来简介操作,每次要用的时候输入setproxy,不用了就unsetproxy。
alias setproxy="export ALL_PROXY=http://127.0.0.1:1080" alias unsetproxy="unset ALL_PROXY"

#用这条命令来验证,不能使用ping(ping的协议不是https,也不是https,是ICMP协议)
curl -vv http://www.google.com

如果指向对某些命令进行代理,也可以改相应工具的配置,比如apt的配置

sudo vim /etc/apt/apt.conf
在文件末尾加入下面这行

Acquire::http::Proxy "http://proxyAddress:port"

重点来了!!如果说经常使用git对于其他方面都不是经常使用,可以直接配置git的命令。
使用ss/ssr来加快git的速度
直接输入这个命令就好了
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'

原文地址:https://www.cnblogs.com/sstealer/p/13817949.html