2

Somehow I must have initiated a git at my home directory because now when I type 'git status,' I'm getting a whole list of of 'untracked files' which include my personal folders for my computer that have nothing to do with Github (Pictures, Downloads, Documents, Desktop, etc...).

When I type ls -a at my 'root' (for me, it's at /Users/(my name)), I am seeing .git which means I have a git directory here and am not supposed to. I found a related question on stack overflow below - my follow up to this question is, since I have folders within my home drive that are legitimate git repos and that I do want to keep, I want to make sure I'm not deleting those with the recursive rm.

I am a super newbie, so it's difficult for me to know what I should even be searching for. I've spent a few hours on this already with little progress. Another possible solution I've found is to add my home drive to gitignore, but it would be even better if I could completely remove the '.git' from my home folder completely.

Related: How to undo git init on a home directory?

Community
  • 1
  • 1
Christine
  • 93
  • 1
  • 8

2 Answers2

6

Just remove the .git folder from your home directory.

rm -rf ~/.git will only remove the .git folder that lives directly within your home folder. It will not touch any other git repositories you may have in other locations within your home folder.

Hawken MacKay Rives
  • 1,171
  • 1
  • 16
  • 26
  • 1
    Thank you. I tried `rm -rf .git` a few times when I was at my root directory (`User/(my name)`) which did not work, so I'm not sure what difference the tilde in front would do. Eventually I was able to delete the contents inside the `.git` folder using the extremely technical method of opening it in a Finder window. Thank you though - I will try if it happens again! – Christine Apr 27 '16 at 23:30
  • it worked on ubuntu 20.04 – Ganesh Kharad Sep 08 '22 at 06:38
0

rm -rf ~/.git is the command that I used on a mac computer and it did work.

Josue Gisber
  • 356
  • 2
  • 5