在使用 Git 时,经常会遇到如下错误:
Recv failure: Connection was reset 或者是 Failed to connect to http://github.com port 443 after × 等错误信息。重试多次也不一定能够正常使用,这个时候需要为 Git 进行单独配置。×××× ms: Couldn't connect to server
确认好你的代理程序所提供的端口号,一种常见的情况是 7890。
在终端执行如下代码:
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy http://127.0.0.1:7890
执行完成后,可以使用以下命令查看并修改 Git 的配置:
git config --global --edit
如果你想要取消 Git 的代理配置,可以在终端执行如下代码:
git config --global --unset http.proxy
git config --global --unset https.proxy