终端代理配置

macOS & Linux 通过设置 http_proxy、https_proxy,可以让终端走指定的代理。 配置脚本如下,在终端直接执行,只会临时生效: # 设置代理 export http_proxy=http://127.0.0.1:8899 export https_proxy=$http_proxy # 或是一行命令 export https_proxy=http://127.0.0.1:8899 http_proxy=http://127.0.0.1:8899 # 还原代理 unset http_proxy https_proxy 8899 是 http 代理的端口,请根据你的实际情况修改。 Windows 以下代理生效情况均使用 curl -I http://www.google.com 进行验证。 Git Bash 设置方法同 “macOS & Linux” # 设置代理 export http_proxy=http://127.0.0.1:8899 export https_proxy=$http_proxy # -I/–head 只显示请求头信息 $ curl -I http://www.google.com ... # 还原代理 unset http_proxy https_proxy $ curl -I http://www.google.com curl: (28) Failed to connect to www.google.com port 80: Timed out PowerShell # PowerShell 中的 curl 语法: curl....

2025年10月15日 · 1 min · Leanku