How to fix: error: '<filename>' does not have a commit checked out fatal: adding files failed when inputting "git add ." in command prompt
If you have a subdirectory with a .git
directory and try to git add .
you will see this message.
This can happen if you have a git repo and then create/clone another repo in a subdirectory under that repo.
I had the same error Message. I fixed it by deleting the file which causes the error from my Directory.
I hope this helps =)
You don't need to delete the entire file from the directory as the first answer suggests, I just had to delete the .git
directory, and then your git add .
will work
This happens for the reason @Mario Zigliotto suggested, there is another repo in a subdirectory under that repo.