关于初次安装Cocoapods问题总结

328 阅读1分钟

pod install遇到的问题总结:

From https://github.com/CocoaPods/Specs eb37b6b758d5..5da046ef6a69 master -> origin/master $ /usr/bin/git -C /.cocoapods/repos/cocoapods rev-parse --abbrev-ref HEAD fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree. HEAD Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' [!] CocoaPods was not able to update the cocoapodsrepo. If this is an unexpected issue and persists you can inspect it runningpod repo update --verbose /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-1.16.2/lib/cocoapods/sources_manager.rb:187:in 'Pod::Source#update_git_repo' /opt/homebrew/Cellar/cocoapods/1.16.2_1/libexec/gems/cocoapods-core-1.16.2/lib/cocoapods-core/source.rb:354:in 'Pod::Source#update'

遇到这个问题的原因是因为下载的cocoapods 未能正确 设置到origin

遇到这个问题的解决办法是手动下载cocoapods

cd ~/.cocoapods/repos/cocoapods

git clone https://github.com/CocoaPods/Specs.git

下载完后 git pull origin master

我的解决问题办法是 手动修改了文件夹名称 修改成 master

image.png 设置完成后 执行pod install --repo-update

运行成功

总结:

出现问题需要调整方向,错误问题重试3次换思路去找解决办法!!!

能解决的问题都尝试一次,或者找同事查看他们的cocoapods repos的一种文件夹样式 然后解决问题