配置 git nodejs 使用 socks 或 http 代理

环境:
Windows 10 x64
Git for windows 2.18.0-64
Shadowsocks-windows 4.1.0
Proxifier 3.31

配置任意程序代理:
最简单的方式,使用 Proxifier 强制任意程序,使用指定代理。
免去不同程序不同配置的繁琐操作,推荐使用。
Linux 下可使用 ProxyChains 代替。

单独配置 git 代理:
1. 创建 C:\Users\xxx\.gitProxy 文件

2. 创建 C:\Users\xxx\.gitSSHProxy 文件

3. 创建 C:\Users\xxx\.gitconfig 文件

单独配置 nodejs 代理:
nodejs 仅支持配置 http 代理

注意事项:
Shadowsocks 支持 socks 和 http 代理,但不支持 https 代理。
奇怪的是 Chrome 可以配置使用 http 代理访问 https 资源。
但 nodejs 不可以,即便是设置 strict-ssl 为 false 也不行。
表现为从 npm 仓储安装走了代理,但预安装脚本中的自定义下载没有走代理。
原因待查。

参考:
Shadowsocks-windows
ProxyChains
Proxifier
git-config(1) Manual Page
服务器上的 Git – 协议
如何为 Git 设置代理?
我的软件清单
Pros and cons of using a Http proxy v/s https proxy?

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注