在Windows和Linux终端下使用代理的方式

发布时间 2023-10-27 14:44:10作者: 星耀寂夜

背景

在快乐上网的时候,网页会经过代理,但是有些在终端运行的程序不一定会经过代理,比如用git clone github仓库的时候,或者curl 下载github release的时候,如果不走代理,下载可能会很慢很慢。

Windows

在执行git clone前,在终端执行

set https_proxy=localhost:7890
set http_proxy=localhost:7890

清除代理,留空就可以了

set https_proxy=
set http_proxy=

Linux

同样的,在执行命令前先执行

export https_proxy=http://localhost:7890
export http_proxy=http://localhost:7890

清除代理

export https_proxy=
export http_proxy=

注意这里要是 http://ip:port 格式的