How to delete all commits from private repository in github?

I want to add gitignore with 2 files( node_module,another one) in a private repository which is given by github classroom. But I already git pushed for several times on that repository. Now I want to add gitignore, but after adding gitnore. the previous commited files (node_module, another one) are still in that repository. Now how I can remove all previous commits and git init again on that private repo?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum