Xcode项目构建

CocoaPods在pod setup失败

2019-06-30  本文已影响2人  SkyMing一C

CocoaPods在pod setup失败"RPC failed; curl 18 transfer closed with outstanding read data remaining"

报错内容

  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

解决方法:

1. 进入repos目录下
cd ~/.cocoapods/repos

如果没有该目录:

sudo gem install cocoapods

出现.cocoapods的目录后可以ctrl+c终止安装。
备注:苹果系统升级 OS X EL Capitan 后改为

sudo gem install -n /usr/local/bin cocoapods
2. 更换镜像下载地址
pod repo remove master
pod repo add master https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
pod repo update
pod repo remove master
git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master

成功时显示

Cloning into 'master'...
remote: Counting objects: 3260580, done.
remote: Compressing objects: 100% (1012292/1012292), done.
remote: Total 3260580 (delta 2058490), reused 3250757 (delta 2050967)
Receiving objects: 100% (3260580/3260580), 584.59 MiB | 2.65 MiB/s, done.
Resolving deltas: 100% (2058490/2058490), done.
Checking out files: 100% (339686/339686), done.
3. 将origin地址更换为官方原地址
~/.cocoapods/repos/
成功时文件分布
~/.cocoapods/repos/master/.git/config
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    url = https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
...
[remote "origin"]
    url = https://github.com/CocoaPods/Specs.git
    fetch = +refs/heads/*:refs/remotes/origin/*
...
3. 执行搜索测试是否成功
pod search afnetworking

成功之后

搜索测试

资料

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 (均支持)

git://cocoapodscn.com/Specs.git

参考

cocoapods国内镜像

上一篇 下一篇

猜你喜欢

热点阅读