Why is git erroring with 'Assertion failed' on git add .?

git, xcode

Solution

Not sure exactly what's happening but I was in the same situation

- I moved one git repo inside another

- deleted the .git dir thinking it would become a regular subdir

- tried to `git add -A .`

- got the weird error message

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.

Problem

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. 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 ``` What is this?

Original source

Related problems