0

Accidently I created a repo using "Git™ Version Control" in the 'Users' folder on c: (deleting the folder isn't an option). I created a new repo to test what happens when you delete a repo and unfortunately everything inside the repo was deleted. Is there any way to remove the repo and all mentions of it without deleting the files inside?

phd
  • 82,685
  • 13
  • 120
  • 165
  • https://stackoverflow.com/questions/15193565/how-to-undo-git-init-on-a-home-directory Found in https://stackoverflow.com/search?q=%5Bgit%5D+undo+init+home – phd Jan 18 '21 at 00:17

1 Answers1

1

In the normal setup,1 the Git repository proper is itself a sub-directory (or sub-folder) of the top level of your working tree. For instance if your working tree is named C:/Users/, the repository is named C:/Users/.git/.

To remove the repository, simply remove the repository. The working tree is not touched by a recursive removal of the .git/ sub-directory, so it remains intact.

(There's a general principal at work here, and this is: your working tree is yours. Git will write into it when you tell Git to do so, but it's yours. The Git repository sub-directory is Git's, and Git is touchy about who writes into that, so don't let other programs in there. Keep Dropbox's grubby little paws off the repository.)


1You can override this any number of ways, but presuming you didn't explicitly override the normal setup, you have the normal setup.

torek
  • 448,244
  • 59
  • 642
  • 775