git无法clone,连接超时

一、Git限制了推送数据的大小导致的错误。

解决:重新设置通信缓存大小

git config --global http.postBuffer 524288000

二、GitHub.com无法访问,连接超时

分析:怀疑连接不到github.com,在cmd窗口中,尝试ping一下百度。

命令窗口:ping www.baidu.com   

然后再ping一下github.com

C:\Users\Bai>ping github.com

正在 Ping github.com [111.13.100.91] 具有 32 字节的数据:
请求超时。
请求超时。
请求超时。
请求超时。

111.13.100.91 的 Ping 统计信息:
    数据包: 已发送 = 4,已接收 = 0,丢失 = 4 (100% 丢失),

确实ping不通。

因此怀疑是:本地DNS无法解析导致的。

三、错误解决

打开C:\Windows\System32\drivers\etc\hosts,

确实没有github.com的解析 
在文件末尾添加如下内容,并保存:

192.30.255.112  github.com git 
185.31.16.184 github.global.ssl.fastly.net  

重启cmd窗口,继续ping一下github.com:

 三、今天(2019-11-19)又遇到了

上述办法都尝试了还是不行,于是我这样做成功了

git clone https://github.com/xxx.git

提示下载失败,

可以尝试把https://换成 git://

git clone git://github.com/xxx.git

原文地址:https://www.cnblogs.com/guochaoxxl/p/15625861.html