Entire computer in Git status untracked files
Solution 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 :)
Solution 2
Just Goto C/D or any other drives & run git command 'rm -rf .git'.
NICK
Updated on July 21, 2022Comments
-
NICK almost 2 years
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.
-
NICK over 8 yearsI did run git init but I do not remember where. I think it was the first thing I ran when the terminal opened. Im confused regarding the paths and "control". Can I message you ? Thnks
-
Armin Braun over 8 yearsJust add the output of
git status
in some directory to the question maybe? That way the next guy running into this will be helped also ;) -
Jonathan Leffler over 8 years@NICK: In your terminal, first run
ls -ld /.git
; if that shows you a directory, that's where you're repository is. If that doesn't show anything (generates an error message), runfind $HOME -type d -name .git
to find Git repositories. If that doesn't show up anything either, change$HOME
to/
, but be aware it will read through all the directories in the system (that you have permission to access). Then you've found your Git repository. You can add that info to the question, and get advice from there. -
Armin Braun over 8 yearsIn that case deleting the repo from github.com is sort of irrelevant to your local problem. Appears your git repo on the local machine is gone already. Probably delete it on github.com anyhow though, does not seem as though it contains what you wanted it to contain in the first place :)
-
Armin Braun over 8 yearsNo the untracked simply states what files in the folder you initialized the git repository in, are not (yet) tracked by git. This has nothing to do with what's been pushed to github.com for example. It is safe to say though, that if you deleted the github reposity those files are likely nowhere but on your machine :) This is not a matter of taking time though, git instantly realizes this once the .git folder is gone. Maybe just nervous/bad timing with the git status and prior deleting of the repo ?
-
NICK over 8 years@JonathanLeffler I think I found the location but it says no file or directory. What should I do?
-
Armin Braun over 8 yearsIt says that for the
rm -r .git
? If so, then you're not at the root of your repo -
NICK over 8 years@ArminBraun, thank you for your patience but I don't understand how to get there. Could you please explain? Thank you
-
Armin Braun over 8 yearsNp, but look :) Make your life easier here, so I can give you clear steps: just
cd
to whatever folder you think is still under git and rungit status
:) Then paste the output here or better yet add it to your question and you'll get a step by step guide to resolving your issue in minutes ;) -
NICK over 8 years@ArminBraun I pasted it. Let me know what you thinK! Thank you!!