I tried this but git uses ~/.git for any subdirectory of $HOME. For example, if you type `git add .` while in ~/code/some-project, you will add it to your dotfiles repository. It's easy to undo but still kind of annoying.
If your project has its own .git directory, no, it won't add to ~/.git.
export GIT_CEILING_DIRECTORIES=~
to your .bashrc (or equivalent)