I also have to provide a snapshot of my code for every module in my Pluralsight courses, so being able to archive my git repo into a zip file is very handy.
For some reason, I can never remember how to do this, and find myself looking it up repeatedly. So I've finally decided to write about it here, in hopes that it will help someone other than just me.
If you want to backup a git repo, completely detaching it from git, use one of the following variations of the git archive command:
git archive --format zip --output /full/path/to/zipfile.zip master
git archive master | tar -x -C /somewhere/else
Tar / Bzip
git archive master | bzip2 >source-tree.tar.bz2
Note that the archive will not contain the .git directory, but will contain other hidden git-specific files like .gitignore, .gitattributes, etc.