If you ever pushed your credentials into GitHub and you had many commits after that incident then it would be a big problem removing the credentials from the history. So one of the options would be to delete the whole commit history. In this tutorial...

Markdown supported · ⌘↵ to post
Appreciate your hard work and consistency keep going.
We can use this if we have leaked our credentials by mistake
Güven Göç
Thank you for this useful article.