The root cause of this error in my case was that I have a subdirectory with its own .git folder inside. When I issued the git add --all command, I got this same error.
Here's how I resolved the issue:
Remove all .git folder inside the sub directory causing the error
cd to the main directory
git rm --cached sub_directory_name -f
git add --all to add the subdirectory and contents, recursively
git status to verify that the items are added