为什么git在'git add'上发生'Assertion failed'错误。 [英] Why is git erroring with 'Assertion failed' on git add .?
问题描述
我分叉回购,然后将其克隆到我的Mac中,放入 / YATC
目录中。我在另一个目录中创建了一个以前创建的Xcode项目(TwitterTimeline),并将其复制到 / YATC目录
中。我在/ YATC目录中做了 git add。
,并且只有一个空的TwitterTimeline目录被添加到了回购站中。没有其他文件被添加。后来我发现在TwitterTimeline中已经有一个 .git
目录。我认为Xcode必须创建它,尽管我不记得曾经这么做过。
I forked a repo, then cloned it to my Mac into a /YATC
directory. I had a previously-created Xcode project (TwitterTimeline) in another directory, which I copied into the /YATC directory
. I did git add .
in the /YATC directory, and only an empty TwitterTimeline directory was added to the repo. No other files were added. I later found out that there was already a .git
directory in TwitterTimeline. I think Xcode must have created that, although I don't recall ever asking it to.
无论如何,我删除了 TwitterTimeline / .git
目录。我回到了 / YATC
,并试图在那里做 git add。
,并没有发生任何事情。意思是我立即做了 git status
,它说没有什么可提交的。然后我进入TwitterTimeline目录并执行 git add。
,并得到以下结果:
Anyway, I deleted the TwitterTimeline/.git
directory. I went back up to /YATC
and tried to do git add .
there, and nothing happened. Meaning I immediately did git status
, and it said there was nothing to commit. Then I went down to the TwitterTimeline directory and did git add .
, and got the following:
Assertion failed: (item->nowildcard_len <= item->len && item->prefix <= item->len), function prefix_pathspec, file pathspec.c, line 308.
Abort trap: 6
这是什么?
推荐答案
不确定到底发生了什么,但我处于相同的情况中
Not sure exactly what's happening but I was in the same situation
- 我在另一个git仓库中移动了一个git仓库
- 删除了.git dir仓库,认为它会变成一个普通的子仓库试图将
- c> git add -A。
- 得到奇怪的错误信息
我通过重命名子目录来解决它,从父目录执行 git add
,然后将子目录重命名为原始名称。不知何故,这似乎让git回到工作状态。
I got around it by renaming the subdir, doing git add
from a parent dir, then renaming the subdir back to the original name. Somehow that seemed to get git back in a working state.
这篇关于为什么git在'git add'上发生'Assertion failed'错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!