The proper way to delete a Git repository

Sep 17, 2022 · 1 min read · Post a comment

Besides automation, running rm -rf against directories is my second to none thing to do as a DevOps engineer. And this is exactly how you could easily remove a Git repository.


  • Git


Step 1. Go to your current Git project directory.

Step 2. Run the sacred command:

rm -rf .git

Step 3. Verify.

git status

Expected output:

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

To remove a remote Git repo which is usually hosted on GitHub or GitLab you must follow the official platform-specific docs.


To find more neat Git commands and hacks, browse the Git category. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.