Git is tracking files that aren't there

  • When I create a new working directory (anywhere on my mac) and type ‘git remote -v’  there is already a git remote associated with the working directory (even though I didn’t add it).  Every new remote I add is also automatically being added to every folder on my computer.

  • Then when I add/commit/push to a repository, there are many folders/files that are being pushed that aren’t in the directory (including an entire mobile application which is present in my dropbox and the dropbox folder itself!). When I run ‘git status’ - even on fresh directories there are untracked files. 

  • I’ve tried various combinations of ‘reset’ and ‘clean’. I’ve also installed a new version of git using homebrew and changed to using that but the problem is still there. 

Any help would be greatly appreciated as it basically means I can’t use git whilst it is tracking all these extra folders. Thanks

Sorry I finally found a stackoverflow that helped - turns out I was tracking my home directory. I must have run git init from within the home directory at some point 🤦 . So just …

rm -rf .git

from the home directory did the trick.

https://stackoverflow.com/questions/34484800/entire-computer-in-git-status-untracked-files

3 Likes