Git 设置本地代理

Oct 22, 2024 • 预计阅读时间 1 分钟

虽然代理类工具都提供「增强模式」来接管全局代理,但是有时候仅仅需要对浏览器和 git 设置代理。

$ git config --global http.proxy 'socks5h://127.0.0.1:1080'

socks5hsocks5 都可以配置 socks5 代理,区别在于 socks5h 是在远程解析 DNS,socks5 是本地解析 DNS。

题外话,curl 也有对应的参数:

$ curl --socks5 127.0.0.1:1080 https://google.com
$ curl --socks5-hostname 127.0.0.1:1080 https://google.com

–socks5-hostname: Use the specified SOCKS5 proxy (and let the proxy resolve the host name).

Git
版权声明:如果转发请带上本文链接和注明来源。

lvv.me

iOS/macOS Developer

Debian 从官方源安装 nginx 并且开启 HTTP/3