Entire computer in Git status untracked files

NICK picture NICK · Dec 27, 2015 · Viewed 10.3k times · Source

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.

Answer

Armin Braun picture Armin Braun · Dec 27, 2015

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 :)