问题描述:git clone https:// 时出错
解决办法:编辑全局配置
查看全局配置:
git config --global -l
http.sslverify=false
:这个配置意味着禁用了对HTTPS连接进行SSL证书验证。这可能会导致不安全的连接,可以设置为true
url.git://github.com/.insteadof=https://github.com/
和 url.git://github.com.insteadof=https://github.com
:这两个配置用于将Git协议(git://)的URL转换为HTTPS协议(https://)的URL(重复,通常情况下只需要配置一个即可生效)
url.https://github.com/.insteadof=git://github.com/
和 url.https://github.com.insteadof=git://github.com
:这两个配置用于将HTTPS协议(https://)的URL转换为Git协议(git://)的URL。这样的配置一般情况下较少使用,特别是当使用HTTPS连接时。如果不需要显式地将HTTPS URL替换为git:// URL,可以删除其中一个或两个配置。
原因分析
当url.git://github.com/.insteadof=https://github.com/和url.https://github.com/.insteadof=git://github.com/
同时存在时,Git 会根据配置的顺序进行匹配与替换,但是可能会导致意外的行为或错误,所以我的解决办法是删除这些配置:
git config --global http.sslverify true
git config --global --unset url.git://github.com/.insteadof
git config --global --unset url.https://github.com.insteadof
git config --global --unset url.https://github.com/.insteadof
git config --global --unset url.git://github.com.insteadof
再次执行以下命令可以看到删除成功:
重新git clone https://: ,出现新的错误:
error: RPC failed; curl 56 OpenSSL SSL_read: Connection was reset, errno 10054
error: 432 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
原因分析:出现这种问题可能是文件太大了,curl的postBuffer的默认值较小,需要在终端调整为到合适的大小
修改GIT缓存的大小为100M,如果依然报错,继续调大:
git config --global http.postBuffer 100M
git clone 成功
文章来源:https://www.toymoban.com/news/detail-613262.html
文章来源地址https://www.toymoban.com/news/detail-613262.html
到了这里,关于fatal: unable to connect to github.com:github.com[0: 20.205.243.166]: errno=Unknown error的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!