github使用时太卡完美解决

步骤1:查找域名对应的ip地址

nslookup github.global.ssl.fastly.Net
nslookup github.com
windows下使用cmd查询
github使用时太卡完美解决github使用时太卡完美解决linux下直接用命令查询
github使用时太卡完美解决步骤2:查询到的内容加入 /etc/hosts文件中

Windows上的hosts文件路径在C:\Windows\System32\drivers\etc\hosts
Linux的hosts文件路径在:sudo vim /etc/hosts
注意如下:
这里有个坑:
只改C:\Windows\System32\drivers\etc\hosts没反应,其他的hosts文件也要改,用everything文件查找hosts
github使用时太卡完美解决在hosts文件末尾添加两行(对应上面查到的ip)

74.86.17.48 github.global-ssl.fastly.net
13.229.188.59 github.com

windows下:
如果出现以下权限问题:
github使用时太卡完美解决解决方法:将修改后的保存到桌面等其他位置,然后删除原hosts文件,再将修改后的拖进去即可。

github使用时太卡完美解决linux下:sudo vi /etc/hosts
github使用时太卡完美解决步骤三:保存更新DNS

Winodws系统的做法:打开CMD,输入ipconfig /flushdns
github使用时太卡完美解决

Linux的做法:在终端输入sudo /etc/init.d/networking restart
github使用时太卡完美解决

early EOF error

解决方式1:为git添加 compression 配置项

解决办法:git config --global core.compression -1

compression 是压缩的意思,从 clone 的终端输出就知道,服务器会压缩目标文件,然后传输到客户端,客户端再解压。取值为 [-1, 9],-1 以 zlib 为默认压缩库,0 表示不进行压缩,1…9 是压缩速度与最终获得文件大小的不同程度的权衡,数字越大,压缩越慢,当然得到的文件会越小。
2.可以增加git的缓存大小

git config --global http.postBuffer 1048576000

将http.postBuffer设置的尽量大,例如

git config --global http.postBuffer 524288000 (500M)
git config --global http.postBuffer 1048576000 (1G)

再大的应该是依次类推吧
因为下载的时候不止是工程数据,还有其它配置数据,总量会大于工程数据量,所以设置的缓存大小一定要比工程大小多一些。
3.配置git的最低速和最低速时间

git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999 //单位 秒

相关文章: