0

My problem is that I can't push, because i accidentally committed a wrong file. Everytime I try to push i get FATAL ERROR: Forbidden file types detected: ... Main.class

I already tried reverting the commit, but I get the same error again. So how do I remove the file from commiting?

phil330d
  • 31
  • 1
  • 4
  • Possible duplicate of [How to modify existing, unpushed commits?](https://stackoverflow.com/questions/179123/how-to-modify-existing-unpushed-commits) – phd May 22 '18 at 21:42

1 Answers1

1

Try instead to do a git reset @~, to restore the index to the previous commit.
That won't touch your working tree (ie your files on your disk): only a git reset --hard would do so.

From there, you can add again your files, except this time, do exclude any .class file (ideally through a .gitignore file with a *.class in it)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250