gpt4 book ai didi

xcode - 工作副本 “Pods” 无法提交文件 - Realm 错误

转载 作者:行者123 更新时间:2023-11-28 06:53:14 26 4
gpt4 key购买 nike

由于以下错误,我无法将我的 Xcode 项目更改提交到 Github。如下所示,它与 Realm 有关。我最近更新了 pod 。有关如何解决此问题的任何建议。

enter image description here

enter image description here

enter image description here

enter image description here

最佳答案

假设你想提交你的 Pods到 Git 的目录,这样可以确保在您 checkout 某个修订版时始终可以编译您的项目,而无需运行 pod install之前,那么您可以在 Pods 中重置暂存区中的内容通过在项目目录中运行以下命令来创建目录:

git rm --cached -r Pods
git add -A Pods

(免责声明:运行此类命令可能会丢失数据。如有必要,请熟悉它们的含义,以免意外删除要提交的内容。)

或者,您可以添加 Pods目录到您的 .gitignore文件。这将确保您不能提交 Pods目录,但有必要 pod install在更改 Podfile.lock 后运行当例如切换分支、协作和 CI。

您可以通过在项目目录中的 shell 上执行以下命令来实现:

 echo "/Pods" >> .gitignore

之后,您需要将更改提交到您的 .gitignore到您的存储库。此外,我建议对您的存储库进行专门的提交,您可以在其中删除 Pods 下的文件。目录。这只会影响存储库内容,而不会影响您的本地结账。


CocoaPods 指南“使用 CocoaPods”有一章 "Should I check the Pods directory into source control?" ,详细讨论了它的优点和缺点:

Should I check the Pods directory into source control?

Whether or not you check in your Pods folder is up to you, as workflows vary from project to project. We recommend that you keep the Pods directory under source control, and don't add it to your .gitignore. But ultimately this decision is up to you:

Benefits of checking in the Pods directory

  • After cloning the repo, the project can immediately build and run, even without having CocoaPods installed on the machine. There is no need to run pod install, and no Internet connection is necessary.
  • The Pod artifacts (code/libraries) are always available, even if the source of a Pod (e.g. GitHub) were to go down.
  • The Pod artifacts are guaranteed to be identical to those in the original installation after cloning the repo.

Benefits of ignoring the Pods directory

  • The source control repo will be smaller and take up less space.
  • As long as the sources (e.g. GitHub) for all Pods are available, CocoaPods is generally able to recreate the same installation. (Technically there is no guarantee that running pod install will fetch and recreate identical artifacts when not using a commit SHA in the Podfile. This is especially true when using zip files in the Podfile.)
  • There won't be any conflicts to deal with when performing source control operations, such as merging branches with different Pod versions.

Whether or not you check in the Pods directory, the Podfile and Podfile.lock should always be kept under version control.


此外,您可能想检查您的 .gitignore 是否可以改进。例如,我可以从屏幕截图中识别出您有一个 xcuserdata Xcode 项目中的目录,Git 不会忽略该目录。这些是特定于用户的配置文件,不一定属于存储库。如果您与其他人合作,忽略这些可以减少 repo 的大小和拉取请求中的噪音,并使变更集更容易审查。但如上所述,最终取决于您是否要检查它们。 GitHub 托管了一个众包存储库,其中包含适用于多种语言的文件模板。 Their Objective-C file对您来说可能是个不错的起点。

关于xcode - 工作副本 “Pods” 无法提交文件 - Realm 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34381327/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com