I have also encountered the same issue, and have resolved it as follows:
- Clone your same project in some other folder.
- Copy the (hidden)
.gitfolder of the cloned project. - Finally replace the
.gitfolder of the original project with the one that you’ve have copied.
Edit
Why does this happen?
- Broken git repositories are often the result of file system corruption due to abrupt power failure or other abnormalities.
- Since git stores all the information inside
.gitfolder and if they are corrupted git can no longer recognize the repository.
Caveats
Everything in your previous .git folder will be gone. Configurations like remote reference name(s) must be set up again.