Empty file by git status...git commit/push error

Dear team,

i just did git add->commit->push…but it showed me empty-file error…

I did not change or delete anything in my project 3 file…why would this error occur?
image

thanks in advance

You could try these commands:

Or you could try to clone the project new and copy the files.

Do you always properly exit the VM?

1 Like

I am not sure…when i changed my #include statements in my .h and .c docs…i accidently deleted the two
#pragma once” in wordle.h and dict.h…right after that when I implement make or make check…there was an endless loops, so that I could not compile it…but after I add these two “#pragma once” back, then the compiler works normally…but now…the empty error occurred…

Well, changing your C code should not break the files internally used by git to keep history.

Also, again,

Or you could try to clone the project new and copy the files.

Do you always properly exit the VM?

1 Like

“you could try to clone the project new and copy the files.”
I just did this and it worked…

“Do you always properly exit the VM?”
I think I always properly exit the VM…usually I saved and closed the files first before turning off the VM…

Like I said…I deleted “#pragma once”…and there was a warning about nestes #include
when I compiled my program, there was a endless loops… as long as I can remember…the lines jumped from “include wordle.h” to “include dict.h” or something like this…

Thanks you two anyway :smiley: :+1:

How do you do this?

after i saved and closed my files i project

I click the close button on the window
image
then here clicking the close button again
image

should there be something wrong with it?

2 Likes

OMG, I see…thanks for your feedback an help :smile:

Hello, i have exactly the same problem that after i added, i get error messages when commiting.
i tried all the proposed solutions to clean up my git but it always says that two files are empty and one is corrupt. Do you have any further suggestions what i could do?

Have you tried cloning, copying the changed files and then commiting and pushing?

Similar topics:

https://forum.prog2.sic.saarland/t/git-error-problems-when-committing-the-project/1025/2?u=marcel.ullrich2

https://forum.prog2.sic.saarland/t/git-error-unable-to-use-any-git-commands-in-project2/987/2?u=marcel.ullrich2

Hello Simon, as the other tutors suggested…maybe you should copy your files to another place…and do a cloning for your current project again…and then copy the changed contents from the saved files to your newly cloned ones…then add, commit and push again…that’s what I did last time…
if it would solve your problem, then check if you shut down your VM correctly as we discussed above…
wish you good luck