You can, of course, use –exclude and avoid adding the .git folders to your tar archive, but I discovered a really cool option that excludes the folders created by a whole host of version control systems:
--exclude-vcs
Which, as of version 1.32, means excluding CVS, RCS, SCCS, git, SVN, Arch, Bazaar, Mercurial, and Darcs as follows:
- CVS/ — recursive
- RCS/ — recursive
- SCCS/ — recursive
- .git/ — recursive
- .gitignore
- .gitmodules
- .gitattributes
- .cvsignore
- .svn/ — recursive
- .arch-ids/ — recursive
- {arch}/ — recursive
- =RELEASE-ID
- =meta-update
- =update
- .bzr
- .bzrignore
- .bzrtags
- .hg
- .hgignore
- .hgrags
- _darcs