How to un-initialize a git folder in the root of my pc?

625 Views Asked by At

I am beginner with git. A few weeks ago, I unintentionally created a "git init" on the root of my pc (location: desktop) which means all of my computer files are on that git folder.

How can i delete that git folder, without losing any of my coding or personal files?

2

There are 2 best solutions below

2
On

You should have a hidden folder .git in the root directory then. You just have to delete that folder. It will delete only the git repository and leave all of the other files intact.

0
On

That's ok, I think that's happenened to any of us haha.

From your terminal, after navigating to your home directory (cd ~ if on MacOS, cd \user\username if on Windows), find the directory of this new project, then you can just run rm -rf <project-directory-name>.

If you just want to remove Git from your directory without removing the whole project, you can just remove .git at the root directory of it (cd <project-directory-name>, then rm -rf .git).