[英]“pod init” creates error that says “You need at least git version 1.8.5 to use CocoaPods”
我无法在我的系统中安装任何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>'
我还检查了我的Git版本是1.8.4,但我得到任何解决方案来更新相同的。
它需要在Xcode(首选项)中设置命令行工具版本。
如果您已经支付了Apple开发者帐户/ ID,可以从Apple下载门户下载最新的命令行工具。
这是当前稳定的beta Xcode工具和支持命令行工具下载链接。 (确保您使用Apple Developer Account上的高级开发者帐户登录以访问这些链接)
Xcode 11
Xcode 10
在系统中安装了最新的命令行工具后,从Xcode菜单中进行设置。
(Xcode菜单项)Xcode►首选项►位置►命令行工具►选择适当的命令行工具
首先使用命令删除系统中的现有git: -
使用命令“which git”给你的路径说“/ usr / local / bin / git”,然后使用命令 - > $ sudo rm -rf / usr / local / bin / git
这将从您的系统中删除现有的git然后再次重新安装git
$ brew install git
它可能会发出警告说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.
然后运行下面提到的命令: -
$ sudo chown -R $(whoami) /usr/local/share/
$ sudo chown -R $(whoami) /usr/local/lib
$ brew link --overwrite --dry-run git
它可能会给你错误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'
强制链接并覆盖所有冲突文件:brew link --overwrite git
列出所有要删除的文件:brew link --overwrite --dry-run git
然后最后运行命令
$ brew link --overwrite git
这是我更新我的git和pod init工作的方式。 希望你觉得它有用:)
安装第二个Xcode
后我遇到了类似的问题。 因此, xcode-select -p
没有指定command line tools
通过手动选择较新的Xcode
版本来修复
我在安装最新版本的XCode 9.3后遇到了这个答案 -
我试图做一个 -
Xcode首选项中的位置中的命令行工具设置显示命令最新“9.3正确”安装的线路工具,但在阅读上述答案后,我决定再次使用 - 安装它 -
xcode-select --install
下载/安装后,pod再次开始工作,仍然存在brew问题,这是一个很高的问题。 修复 - https://github.com/Homebrew/brew/issues/3285 。
运行命令$ brew install git
然后导航到项目文件夹并键入pod init
这些步骤对我有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.