前言
使用Git在Push或Clone经常出现443或者10054错误,上传超时.修改多次后只能当时有效,所以解决该问题并记录下。
正文
10054
**10054产生原因:**一般是因为服务的SSL证书没有经过第三方机构的签署。
fatal: unable to access 'https://github.com/.......': OpenSSL SSL_read: Connection was reset, errno 10054
**解决方法:**接触SSL验证后,再次Git。
git config --global http.sslVerify "false"
443
**443产生原因:**如果开启VPN等翻墙工具,或者代理工具全局代理。因为代理的问题会出现上传超时等问题。
Failed to connect to github.com port 443 after 21074 ms: Timed out
解决方法1:
#查看git的http代理设置
git config --global http.proxy
#查看git的https代理设置
git config --global https.proxy
-
比如我用的是Clash,默认端口号是:7890
-
所以在git bash命令中输出以下命令
git config --global http.proxy 127.0.0.1:7890
git config --global https.proxy 127.0.0.1:7890
- 如果需要更换代理设置,则使用如下命令取消代理:
git config --global --unset http.proxy
git config --global --unset https.proxy
解决方法2:
-
修改hosts文件,把GitHub的IP特殊照顾
-
打开https://github.com.ipaddress.com/ 记录IP Address
-
打开https://fastly.net.ipaddress.com/github.global.ssl.fastly.net#ipinfo记录IP Address
-
打开https://github.com.ipaddress.com/assets-cdn.github.com记录IP Address,注意这里会有三个,全部记录
-
打开电脑的hosts文件添加到最后,Windows的hosts文件在
C:\Windows\System32\drivers\etc
里,使用记事本打开,添加到最后 -
然后使用管理员权限打开Windows PoweShell输出ipconfig /flushdns
OVER.
总结
Git确实好用,使用Git管理本地仓库或各种远程仓库。可以有效提高工作效率,管理远程仓库时,由于国内的环境,难免遇到问题。多去思考或搜索问题原因,总有适合你的方法!
评论区