Error: '[Folder/Directory name]' does not have a commit checked out

Hello everyone! This blog is all about the issue that I faced While pushing my code to the GitHub repository.

Context

So, I was working on my MERN stack project and I was done with it and decided to push the code to my GitHub repository. Everything was fine till then but whenever I did

git add .

shows an error that is

error: 'frontend/' does not have a commit checked out fatal: adding files failed

My folder Looked like this:

  -> Project (Parent folder)
     -> frontend
     -> server

So I google it about the error and I found out there's some wrong with/within my folders.

How to solve it?

Here is the solution

Just check for .git folder in your folder structure make sure to check in every folder and don't forget to enable Show hidden files in the file explorer. If the .git folder exists delete it and that's it.

Thanks for reading!

I appreciate you for taking the time to read this far.

Have Fun!