ios “pod init”创建错误,提示“您至少需要 git 版本 1.8.5 才能使用 CocoaPods”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44840351/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"pod init" creates error that says "You need at least git version 1.8.5 to use CocoaPods"
提问by Ishika
I was not able to install any pod in my system.
Hence, I removed cocoapods from my Mac and then reinstalled it.
The process was successful but when I run the command pod init
following error shows up in the terminal:
我无法在我的系统中安装任何 pod。因此,我从 Mac 中删除了 cocoapods,然后重新安装了它。该过程成功,但是当我运行命令pod init
时,终端中出现以下错误:
`verify_minimum_git_version!': [!] You need at least git version 1.8.5 to use CocoaPods (Pod::Informative)
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/command.rb:49:in `run'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/bin/pod:55:in `<top (required)>'
from /usr/local/bin/pod:23:in `load'
from /usr/local/bin/pod:23:in `<main>'
I also checked my Git version which was 1.8.4 but I am getting any solution to update the same.
我还检查了我的 Git 版本,它是 1.8.4,但我得到了任何更新相同的解决方案。
采纳答案by Pradeep Kashyap
Firstly remove the existing git in your system using commands:-
首先使用命令删除系统中现有的 git:-
Use command "which git" that will give u the path say "/usr/local/bin/git", then use command->$ sudo rm -rf /usr/local/bin/git
使用命令“which git”会给你路径说“/usr/local/bin/git”,然后使用命令->$ sudo rm -rf /usr/local/bin/git
This will remove existing git from your system Then reinstall git again
这将从您的系统中删除现有的 git 然后再次重新安装 git
$ brew install git
It might issue a warning saying
Warning: git 2.13.2 is already installed, it's just not linked.
You can use `brew link git` to link this version.
它可能会发出警告说
Warning: git 2.13.2 is already installed, it's just not linked.
You can use `brew link git` to link this version.
Then run below mentioned command:-
然后运行下面提到的命令:-
$ sudo chown -R $(whoami) /usr/local/share/
$ sudo chown -R $(whoami) /usr/local/lib
$ brew link --overwrite --dry-run git
It might give you error
Error: Could not symlink share/git-core/templates/description
Target /usr/local/share/git-core/templates/description
already exists. You may want to remove it:
rm '/usr/local/share/git-core/templates/description'
它可能会给你错误
Error: Could not symlink share/git-core/templates/description
Target /usr/local/share/git-core/templates/description
already exists. You may want to remove it:
rm '/usr/local/share/git-core/templates/description'
To force the link and overwrite all conflicting files: brew link --overwrite git
强制链接并覆盖所有冲突文件: brew link --overwrite git
To list all files that would be deleted: brew link --overwrite --dry-run git
列出所有将被删除的文件: brew link --overwrite --dry-run git
Then finally run command
然后最后运行命令
$ brew link --overwrite git
This is how I updated my git and pod init worked. Hope you find it helpful :)
这就是我更新 git 和 pod init 工作的方式。希望你觉得它有帮助:)
回答by Krunal
It needs to set your command line tool version, in your Xcode (Preferences).
它需要在您的 Xcode(首选项)中设置您的命令行工具版本。
You can download latest command line tool from Apple Download Portal, if you have paid apple developer account/id.
如果你已经支付了苹果开发者账号/id,你可以从苹果下载门户下载最新的命令行工具。
Here are current stable and beta Xcode Tools and supporting command line tool download links. (Ensure you're logged in using premium developer account on Apple Developer Account to access these links)
以下是当前稳定版和测试版的 Xcode 工具以及支持的命令行工具下载链接。(确保您使用 Apple Developer Account 上的高级开发者帐户登录以访问这些链接)
Xcode 11
Xcode 10
Xcode 10.2.1
- (Command Line Tool (Xcode 10.2.1) - for macOS 10.14)Xcode 10.2
- (Command Line Tool (Xcode 10.2) - for macOS 10.14)Xcode 10.1
- (Command Line Tool (Xcode 10.1) - for macOS 10.14)
- (Command Line Tool (Xcode 10.1) - for macOS 10.13)Xcode 10
- (Command Line Tool (Xcode 10) - for macOS 10.14)
- (Command Line Tool (Xcode 10) - for macOS 10.13)
Xcode 11
Xcode 10
Once you've latest command line tool installed in your system, set it from Xcode Menu.
在系统中安装最新的命令行工具后,从 Xcode 菜单设置它。
(Xcode Menu Items) Xcode ? Preferences ? Location ? Command Line Tool ? Select appropriate command line tool
(Xcode 菜单项) Xcode ? 喜好 ?地点 ?命令行工具 ? 选择合适的命令行工具
回答by Tim
I had a similar issue after installing a second Xcode
.
As a result there was no command line tools
specified in xcode-select -p
安装第二个Xcode
. 结果没有command line tools
指定xcode-select -p
Fixed by manually choosing newer Xcode
version
通过手动选择较新Xcode
版本修复
回答by Sandip Patel - SM
Do as suggested below and it will fix this issue:
按照以下建议进行操作,它将解决此问题:
Xcode Preferences -> Locations -> Selected the Command Lin Tools: select Xcode 8.3 or whatever you want to select.
Xcode Preferences -> Locations -> Selected the Command Lin Tools:选择 Xcode 8.3 或任何你想选择的。
Hope it will fix your issue!!!
希望它能解决你的问题!!!
回答by WickedW
I came across this answer after installing latest version of XCode 9.3 -
安装最新版本的 XCode 9.3 后,我遇到了这个答案 -
I was trying to do a -
我试图做一个 -
- Pod?Update [ or --version, or any pod command ...]
- I tried to "brew install git" like in the top answer but there was all kinds of complaints about no access to Cellar, then when I added access, missing c compilers ..
- Pod?Update [ 或 --version,或任何 Pod 命令 ...]
- 我试图像在最佳答案中那样“brew install git”但是有各种各样关于无法访问 Cellar 的抱怨,然后当我添加访问权限时,缺少 c 编译器 ..
The command line tools setting in Locations in Xcode Preferences showed command latest 9.3 line tools installed "correctly", but after reading the above answers I decided to install it again using -
Xcode 首选项中 Locations 中的命令行工具设置显示了“正确”安装的最新 9.3 行工具命令,但在阅读上述答案后,我决定再次使用 -
xcode-select --install
After the download / install, pod started working again, was still having issues with brew which was a high sierra issue. fixed with - https://github.com/Homebrew/brew/issues/3285.
下载/安装后,pod 再次开始工作,但仍然存在 brew 问题,这是一个高山脉问题。修复 - https://github.com/Homebrew/brew/issues/3285。
回答by Abdul Karim Khan
Run the command
$ brew install git
Then navigate to your project folder and type
pod init
运行命令
$ brew install git
然后导航到您的项目文件夹并键入
pod init
These steps worked for me
这些步骤对我有用