How do I zip up a folder but exclude the .git subfolder

Posted by Tom on Ask Ubuntu See other posts from Ask Ubuntu or by Tom
Published on 2011-02-28T20:38:55Z Indexed on 2011/02/28 23:33 UTC
Read the original article Hit count: 324

Filed under:

I'm trying to create a zip file from a folder and I'd like to exclude the .git sub-folder from the resulting zip file.

I have gone to the parent folder of the one I want to zip (called bitvolution) and I'm doing:

zip -r bitvolution.zip bitvolution -x ".git"

But it doesn't exclude the .git sub-folder.

I've tried various combinations, -x .git*, -x \.git/*, -x .git/\*, -x \.git/\*. I've also tried using the full path for the exclude argument... but just didn't get there.

© Ask Ubuntu or respective owner

Related posts about zip