I had this failing commit scenario due to a renamed directory.
This was the originally created directory with a capitalization mistake:
application/Templates/lists/index.html
Within the IDE, I had agreed to add this file to the existing git repo.
In later testing, I discovered I had a case-sensitive path issue with the capitalization of "Templates". Within the IDE, I simply renamed the directory to "templates" (changed to lower-case). I did not record the actual sequence of events around this, but later when my commit failed with the following message, I had a hunch this was this issue. Apparently, the IDE did not fully handle this case of renaming a directory.
The IDE commit error message:
Commit failed with error: pathspec
"application/templates/lists/index.html" did not match any file(s)
known to git.
After doing some reading, my strategy was to take the file back out and then add it again. I unstaged the suspect file
git reset HEAD lists/Templates/lists/index.html
Note, git status only showed the directory here... Not the file.
Untracked files:
(use "git add <file>..." to include in what will be committed)
lists/templates/
Then, I added back with the corrected directory name (I only used the path for the add, following the lead from git status).
git add lists/templates/
After this, my commit succeeded. I'm not sure if this was the ideal technique, but it resolved the commit error in my case.