加速Github访问

Github 仓库的数据传输很慢,甚至可能导致仓库拉取失败。例如:

remote: Enumerating objects: 67, done.
remote: Counting objects: 100% (67/67), done.
remote: Compressing objects: 100% (51/51), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: unpack-objects 失败

解决方案是设置 Hosts 文件,方案参考:https://blog.csdn.net/w958660278/article/details/81161224。

补充

Mac/Linux 下面修改 Hosts 文件:

sudo vi /etc/hosts

重启网络连接后即可重启配置。

如果是 MacOS,可以使用命令更新 hosts:

sudo dscacheutil -flushcache

再次补充

现在效果来看上一方案效果不佳,最终采用Github访问慢解决方法的最后一种方案,可以达到理想速度。

参考

原文地址:https://www.cnblogs.com/noluye/p/11095860.html