How to Delete a Git Init From Your Repository

If you want to remove a Git Init file, e.g. from a cloned GitHub respository, first make sure that you are in the correct directory, you can run the following command inside your terminal:

rm -rf .git

Now when you run git status, your terminal will tell you:

fatal: Not a git repository (or any of the parent directories): .git

Now you can add your own init file to the repository using git init, and start working with a clean git history file.

Has this been helpful to you?

You can support my work by sharing this article with others, or perhaps buy me a cup of coffee 😊


Share & Discuss on