我正在使用本地 git 存储库。当我尝试提交对核心数据模型文件 (.xcdatamodel) 的更改时,我收到此消息:
error: pathspec '.../DataModel.xcdatamodeld/DataModel.xcdatamodel/contents' did not match any file(s) known to git.
如何像处理任何其他文件一样修复此问题并提交模型?
最佳答案
问题的确是文件名大小写的改变。对我来说,这是因为我的 Macbook/OSX。显然 Windows 具有相同的“东西”。
原因:git 无法识别从“文件名”到“文件名”的更改。
这里有一份解决方案列表,供遇到此问题的任何人使用。所有解决方案都应在项目根目录下运行:
适用于当前和 future 项目的永久修复
更改 git 大小写设置。该文件应在之后提交
git config core.ignorecase false --global
项目只修复
git config core.ignorecase false
只需给我一行代码,这样我就可以继续修复 - 感谢 Bruce
git commit -a -m "pathspec did not match any file(s) known to git fix"
我按小时计酬修复
Delete the file. Commit. Push. Add the file again. Commit. Push.
根据您的需要,您可能想要恢复设置。做:
git config core.ignorecase true
关于Xcode-错误 : pathspec '...' did not match any file(s) known to git,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27325747/