当前位置:   article > 正文

Git配置代理解决 “Failed to connect to github.com port 443“及 “Recv failure: Connection was reset“ 等问题_git github 代理

git github 代理

使用 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
  • 1
  • 2

配置完成后,可以使用以下命令查看并修改 Git 的配置:

git config --global --edit
  • 1

此时 Git 的默认编辑器会打开 ~/.gitconfig 文件,其中包括了代理的配置:

[http]
	proxy = http://127.0.0.1:7890
[https]
	proxy = http://127.0.0.1:7890
  • 1
  • 2
  • 3
  • 4

这样就完成了配置,可以 clone 一个仓库来测试,比如:

git clone https://github.com/github/gitignore.git
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/黑客灵魂/article/detail/857989
推荐阅读
相关标签
  

闽ICP备14008679号