CocoaPods执行 pod setup 遇到的问题
$ pod setup
Setting up CocoaPods master repo
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
$ /usr/local/bin/git -C /Users/sunke/.cocoapods/repos/master fetch origin
--progress
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
[!] CocoaPods was not able to update the `master` repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose
解决:
安装后,还是有问题,说不能设置环境,之后按照这提示运行了
pod repo update --verbose
但是依然不行。
之后试了下加sudo
sudo pod setup
Password:
/usr/local/lib/ruby/gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:439:in `help!':[!] You cannot run CocoaPods as root. (CLAide::Help)
这里看到关键问题了,You cannot run CocoaPods as root 这就好办了。
只要先删除之前的目录:
sudo rm -fr ~/.cocoapods/repos/master
这个时间可能有点长,因为里面有好几百兆的文件呢,等他删除完毕在运行
pod setup
之后就是下载最新的东西了,输出如下:
$ pod setup
Setting up CocoaPods master repo
$ /usr/local/bin/git clone https://github.com/CocoaPods/Specs.git master
--progress
Cloning into 'master'...
remote: Counting objects: 1631882, done.
remote: Compressing objects: 100% (334/334), done.
remote: Total 1631882 (delta 140), reused 35 (delta 35), pack-reused 1631505
Receiving objects: 100% (1631882/1631882), 435.48 MiB | 1.47 MiB/s, done.
Resolving deltas: 100% (869406/869406), done.
Checking connectivity... done.
Checking out files: 100% (191990/191990), done.
CocoaPods 1.4.0.beta.2 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.4.0.beta.2
Setup completed
这里会很慢,因为要下载很多东西,慢慢等吧~
网友评论