0


【Git报错】Couldn‘t connect to server/Connection was reset最全总结

我们都知道Hexo小白最常用到的两条操作为:

hexo g #生成页面
hexo d #部署发布

但在笔者熟悉和摸索这个博客框架时,因为频繁使用这两条操作而遇到了各种报错,但大体上为以下几类情况:

Connection was reset

报错信息大致如下👇

fatal: unable to access ‘https://github.com/xxxx.github.io.git/’: Recv failure: Connection was reset

解决办法

依次将如下两条语句复制到git中后,点击回车。

git config --global --unset http.proxy
git config --global --unset https.proxy

然后在电脑上同时按下win+R,在运行窗口中输入cmd打开命令提示符,输入以下指令清理DNS缓存:

ipconfig/flushdns

如此,就可以正常地将更改上传到博客了。别的地方使用Git也是同样道理。

Connection timed out/ Couldn’t connect to server

报错信息大致如下👇

fatal: unable to access ‘https://github.com/Alpaca10086zyys/Alpaca10086zyys.github.io.git/’: Failed to connect to github.com port 443 after 21106 ms: Couldn’t connect to server

解决办法

在git bash的命令行里输入:

git config --global --unset http.proxy
git config --global --unset https.proxy

几乎全网的解答都有这两句话,可是在笔者多次实践下,这个方案时而灵敏时而不灵,于是笔者又参考了以下方案,一步到位解决了问题。

这个问题本质上是因为本机系统代理端口和Git端口不一致导致的,解决办法是将git配置修改为本机端口号。

设置---网络和Internet---代理---手动设置代理---端口

找到本机端口,然后在git bash里输入:

git config --global http.proxy http://127.0.0.1:xxxxx
git config --global https.proxy http://127.0.0.1:xxxxx

(xxxxx)修改为本机端口号。

回车,即可成功上传修改。

本博文参考文章链接:

git:上传代码时,出现fatal: unable to access ‘XXX‘: Recv failure: Connection was reset 错误解决方法(保姆级教学)

解决 Failed to connect to github.com port 443:connection timed out

[报错解决] Failed to connect to github.com port 443 after ***** ms: Couldn‘t connect to server

标签: git

本文转载自: https://blog.csdn.net/Alpaca10086zyys/article/details/134489828
版权归原作者 糖豆人_编号t41 所有, 如有侵权,请联系我们删除。

“【Git报错】Couldn‘t connect to server/Connection was reset最全总结”的评论:

还没有评论