最近运行pod setup出现以下问题:

remote:Compressingobjects:100%(34/34),done.error:RPCfailed;curl56SSLRead()returnerror-3613.00KiB/sfatal:Theremoteendhungupunexpectedlyfatal:earlyEOFfatal:index-packfailed

我们知道 cocoapods 的 sepcs 文件是放在这个目录里面

~/.cocoapods/repos

所以可以直接 cd 到该目录下然后运行命令:

gitclonehttps://github.com/CocoaPods/Specs.gitmaster

Cloninginto'master'...remote:Countingobjects:894306,done.remote:Compressingobjects:100%(56/56),done.^Cceivingobjects:6%(53659/894306),10.39MiB|216.00KiB/s...

然后会发现clone 的文件很大,由于速度也很慢,一不小心就失败了。

其实我们无需全部 clone 下来,可以只 clone 最近一个 commit 的全部代码就可以了。

gitclone--depth=1https://github.com/CocoaPods/Specs.gitmaster

Cloninginto'master'...remote:Countingobjects:261047,done.remote:Compressingobjects:100%(179891/179891),done.remote:Total261047(delta44498),reused253721(delta44409),pack-reused0Receivingobjects:100%(261047/261047),44.76MiB|124.00KiB/s,done.Resolvingdeltas:100%(44498/44498),done.Checkingconnectivity...done.Checkingoutfiles:100%(118515/118515),done.

不用多久就 clone 成功了,这时候就直接可以使用pod install 最新版本的 library 了。