Entire computer in Git status untracked files

11,661

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:

  1. move to the home folder

    cd ~
    
  2. 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'.

Share:
11,661
NICK
Author by

NICK

Updated on July 21, 2022

Comments

  • NICK
    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
    NICK over 8 years
    I 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
    Armin Braun over 8 years
    Just 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
    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), run find $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
    Armin Braun over 8 years
    In 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
    Armin Braun over 8 years
    No 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
    NICK over 8 years
    @JonathanLeffler I think I found the location but it says no file or directory. What should I do?
  • Armin Braun
    Armin Braun over 8 years
    It says that for the rm -r .git ? If so, then you're not at the root of your repo
  • NICK
    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
    Armin Braun over 8 years
    Np, 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 run git 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
    NICK over 8 years
    @ArminBraun I pasted it. Let me know what you thinK! Thank you!!