使用 git clone 下载 Github 等网站的仓库时,可能会遇到类似 "Recv failure: Connection was reset" 或 "Failed to connect to http://github.com port 443 after 21114 ms: Couldn't connect to server" 的报错。即使打开了全局代理,也会报错。
此时,需要为 Git 单独配置代理
可以使用
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy http://127.0.0.1:7890
进行设置,代理端口为7890
也可以进入文件内手动修改
git config --global --edit
如果没有的话,就添加
[http]
proxy = http://127.0.0.1:7890
[https]
proxy = http://127.0.0.1:7890