美文网首页程序园程序员iOS知识收藏
安装CocoaPods报"RPC failed; cu

安装CocoaPods报"RPC failed; cu

作者: MissSaturday | 来源:发表于2019-02-19 10:28 被阅读326次

    报错内容

    error: RPC failed; curl 18 transfer closed with outstanding read data remaining
      fatal: The remote end hung up unexpectedly
      fatal: early EOF
      fatal: index-pack failed
    

    解决方法:

    更换镜像下载地址
    对于旧版的 CocoaPods 可以使用如下方法使用国内的的镜像(以清华的镜像为例):

    pod repo remove master
    pod repo add master https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
    pod repo update
    

    新版的 CocoaPods 不允许用pod repo add直接添加master库了,但是依然可以:

    cd ~/.cocoapods/repos 
    pod repo remove master
    git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master
    

    最后进入自己的工程,在自己工程的podFile第一行加上:

    source ‘https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git’
    

    重置为官方上游

    cd ~/.cocoapods/repos
    pod repo remove master
    git clone https://github.com/CocoaPods/Specs master
    
    # 最后进入自己的工程,在自己工程的podFile第一行加上
    sources 'https://github.com/CocoaPods/Specs'
    

    资料

    清华大学镜像

    https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
    

    上海大学镜像

    https://mirrors.shu.edu.cn/CocoaPods (仅HTTP/HTTPS访问,不支持git拉取) 
    https://mirrors.shu.edu.cn/mgit/Specs (仅git访问) 
    https://git.shuosc.org/CocoaPods/Specs (均支持)
    

    COCOAPODS SPECS 中国区镜像表项

    git://cocoapodscn.com/Specs.git
    

    借鉴https://blog.csdn.net/guo405240393/article/details/80319520

    问题详情

    今天重装了mac系统,cocoapods需要重装
    执行到pod setup阶段,下载速度22Kib/s,经过了半天的等待,最后来了上面那段错误,简直比吃了屎还难受
    然后搜索解决办法
    发现了https://www.jianshu.com/p/daac08374f46这位简友的文章,于是进行了实验

    git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master
    

    下载速度很快,安装完还是不行,于是进入cocoapods所在文件夹查看,发现了README.md文件,内容大概是此地址已停止更新
    新的地址已迁移到阿里云,下面是推荐地址

    git clone https://gitclub.cn/CocoaPods/Specs.git ~/.cocoapods/repos/master
    

    此地址下载速度100多kib/s
    下载完成后 pod search AFNetworking 测试cocoapods的使用
    报错
    卒。。。
    最终解决办法就是上述解决办法,如有更好的办法,请留言与我联系,谢谢。


    至此完结
    欢迎评论和交流,如果这篇文章帮到了您,点赞留下脚印。
    谢谢

    相关文章

      网友评论

        本文标题:安装CocoaPods报"RPC failed; cu

        本文链接:https://www.haomeiwen.com/subject/umpaeqtx.html