Is there a command to undo git init? – Dev

The best answers to the question “Is there a command to undo git init?” in the category Dev.


I just Git init’ed a repos with a wrong user, and want to undo it. Is there any command for this? Do I actually have to go in and edit the .git directory?


In windows, type rmdir .git or rmdir /s .git if the .git folder has subfolders.

If your git shell isn’t setup with proper administrative rights (i.e. it denies you when you try to rmdir), you can open a command prompt (possibly as administrator–hit the windows key, type ‘cmd’, right click ‘command prompt’ and select ‘run as administrator) and try the same commands.

rd is an alternative form of the rmdir command.


You can just delete .git. Typically:

rm -rf .git

Then, recreate as the right user.


Git keeps all of its files in the .git directory. Just remove that one and init again.

This post well show you how to find the hide .git file on Windows, Mac OSX, Ubuntu


remove the .git folder in your project root folder

if you installed submodules and want to remove their git, also remove .git from submodules folders