问题
I'm new to git and I think I accidentally cloned in the root directory. When I committed one file (index.html) I noticed my whole computer (my desktop, my documents, etc) all in untracked files. I deleted the repository and I want to remove all the untracked files, obviously without deleting everything from my computer. I am new and paranoid about losing my files.
回答1:
You must have run
git init
somewhere. You need to find the folder you ran this in. Just run:
git status
somewhere you think is now under git "control" and you'll see by the paths: say if you have a path like Desktop/myFolder => you know the folder that contains desktop is you git root folder. Just navigate there and run :
rm -r .git
And all should be back to normal :)
Now that we got the status output :) .. Alright as you can see the root of this thing is you home folder. So just do this:
move to the home folder
cd ~
delete the git repo
rm -rf .git
=> git repo is gone for sure :)
回答2:
Just Goto C/D or any other drives & run git command 'rm -rf .git'.
来源:https://stackoverflow.com/questions/34484800/entire-computer-in-git-status-untracked-files