git 错误:无法索引文件 Crashlytics.framework/Headers

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30580948/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 11:04:41  来源:igfitidea点击:

git error: unable to index file Crashlytics.framework/Headers

gitgit-submodules

提问by Deekor

I am using Twitter's Fabric on my iOS app.

我在我的 iOS 应用程序上使用 Twitter 的 Fabric。

Crashlytics in Fabric just updated itself and now I cannot commit my project to git. I get the error:

Fabric 中的 Crashlytics 刚刚自我更新,现在我无法将我的项目提交到git. 我收到错误:

git error: unable to index file Crashlytics.framework/Headers

fatal: updating files failed

git错误:无法索引文件 Crashlytics.framework/Headers

致命:更新文件失败

enter image description here

在此处输入图片说明

Any idea what is going wrong or how to fix it?

知道出了什么问题或如何解决吗?

Running git statusreveals:

跑步git status揭示:

Untracked files:
(use "git add <file>..." to include in what will be committed)

Crashlytics.framework/Info.plist
Fabric.framework/Info.plist
profile.xcodeproj/project.xcworkspace/xcuserdata/
profile.xcodeproj/xcuserdata/

回答by Deekor

Going into terminal and manually committing to git solved the issue. All my further commits in xcode have worked since.

进入终端并手动提交到 git 解决了这个问题。从那以后,我在 xcode 中的所有进一步提交都有效。

git add .
git commit -m "message"

回答by kenorb

I think this relates to the git submodule since I had similar issue. However adding or removing it didn't help. What worked was reseting it into HEAD version, e.g.

我认为这与 git 子模块有关,因为我有类似的问题。但是,添加或删除它并没有帮助。有效的是将其重置为 HEAD 版本,例如

git reset HEAD problematic_file_or_dir

回答by loretoparisi

The same issue happen to me with the Bolts.frameworkand Parse.framework. Both were added in the git repo already, so adding them back did not fixed the issue. I had to remove first:

同样的问题发生在我身上Bolts.frameworkParse.framework。两者都已添加到 git repo 中,因此将它们添加回来并不能解决问题。我必须先删除:

cd MyApp/SDK/
git rm -r Parse.framework/
git rm -r Bolts.framework/

The I had to copy them again in the SDK/ folder and adding to git

我不得不在 SDK/ 文件夹中再次复制它们并添加到 git

 cd MyApp/SDK/
 git add .
 git commit * -m "Maintenance: Fixed git error unable to index file"

回答by gvlasov

This happened to me with IntelliJ IDEA. An error popup appeared when I tried to commit with the IDE git plugin. Probably this is related to the fact that I had staged a path that was previously a file but now is a directory, and have that previous file moved to the new directory.

这发生在我的 IntelliJ IDEA 身上。当我尝试使用 IDE git 插件提交时出现错误弹出窗口。这可能与这样一个事实有关,即我已经暂存了一个以前是文件但现在是目录的路径,并将以前的文件移动到新目录。

Suppose that path is bin/yii. What I did was:

假设路径是bin/yii。我所做的是:

  • Rename the directory to something different, e.g. bin/yii-temp
  • Commit the directory and its contents
  • Rename the directory back to bin/yii
  • Commit with --amendwhat I had just committed.
  • 将目录重命名为不同的名称,例如 bin/yii-temp
  • 提交目录及其内容
  • 将目录重命名回 bin/yii
  • 承诺--amend我刚刚承诺的事情。