工作副本“Pods”无法提交文件 - 领域错误
The working copy “Pods” failed to commit files - Realm Errors
由于以下错误,我无法将我的 Xcode 项目更改提交到 Github。如下所示,它与 Realm 有关。我最近更新了 pods。有关如何解决此问题的任何建议。
假设您要将 Pods
目录提交到 Git,这样可以确保在您检出某个修订版时始终可以编译您的项目,而无需 运行 [=13] =] 之前,那么您可以通过 运行 在您的项目目录中执行以下命令来重置 Pods
目录中暂存区域中的内容:
git rm --cached -r Pods
git add -A Pods
(免责声明:您可以通过 运行 执行此类命令来丢失数据。如有必要,请熟悉它们的含义,以免意外删除要提交的内容。)
或者,您可以将 Pods
目录添加到 .gitignore
文件中。这将确保您将来无法提交 Pods
目录,但是在更改为 Podfile.lock
之后 pod install
是 运行 是必要的,例如切换分支、协作和 CI.
您可以通过在项目目录中的 shell 上执行以下命令来实现:
echo "/Pods" >> .gitignore
完成之后,您需要将对 .gitignore
的更改提交到您的存储库。此外,我建议对您的存储库进行专门的提交,您可以在其中删除 Pods
目录下的文件。这将只影响存储库内容,而不影响您的本地结帐。
CocoaPods 指南 "Using 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
是否可以改进。例如,我可以从屏幕截图中识别出您的 Xcode 项目中有一个 xcuserdata
目录,Git 不会忽略该目录。这些是特定于用户的配置文件,不一定属于存储库。如果您与其他人合作,忽略这些可以减少回购的大小和拉取请求中的噪音,并使变更集更容易审查。但如上所述,最终取决于您是否要检查它们。 GitHub 拥有一个众包存储库,其中包含适用于多种语言的文件模板。 Their Objective-C file 对您来说可能是个不错的起点。
由于以下错误,我无法将我的 Xcode 项目更改提交到 Github。如下所示,它与 Realm 有关。我最近更新了 pods。有关如何解决此问题的任何建议。
假设您要将 Pods
目录提交到 Git,这样可以确保在您检出某个修订版时始终可以编译您的项目,而无需 运行 [=13] =] 之前,那么您可以通过 运行 在您的项目目录中执行以下命令来重置 Pods
目录中暂存区域中的内容:
git rm --cached -r Pods
git add -A Pods
(免责声明:您可以通过 运行 执行此类命令来丢失数据。如有必要,请熟悉它们的含义,以免意外删除要提交的内容。)
或者,您可以将 Pods
目录添加到 .gitignore
文件中。这将确保您将来无法提交 Pods
目录,但是在更改为 Podfile.lock
之后 pod install
是 运行 是必要的,例如切换分支、协作和 CI.
您可以通过在项目目录中的 shell 上执行以下命令来实现:
echo "/Pods" >> .gitignore
完成之后,您需要将对 .gitignore
的更改提交到您的存储库。此外,我建议对您的存储库进行专门的提交,您可以在其中删除 Pods
目录下的文件。这将只影响存储库内容,而不影响您的本地结帐。
CocoaPods 指南 "Using 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, thePodfile
andPodfile.lock
should always be kept under version control.
此外,您可能想检查一下您的 .gitignore
是否可以改进。例如,我可以从屏幕截图中识别出您的 Xcode 项目中有一个 xcuserdata
目录,Git 不会忽略该目录。这些是特定于用户的配置文件,不一定属于存储库。如果您与其他人合作,忽略这些可以减少回购的大小和拉取请求中的噪音,并使变更集更容易审查。但如上所述,最终取决于您是否要检查它们。 GitHub 拥有一个众包存储库,其中包含适用于多种语言的文件模板。 Their Objective-C file 对您来说可能是个不错的起点。