The correct expression is -x '*.git*', so the full command should be:
zip -r bitvolution.zip ./bitvolution -x '*.git*'
An explanation from http://selfsolved.com/problems/zip-command-exclude-svn-director:
Answer from Isaiah on askubuntu.comThe correct incantation is
zip -9 -r --exclude=*.svn* foo.zip [directory-to-compress]You can also add a
--exclude=*.DS_Store*to exclude the annoying Mac OS X directory display metadata files.Notice that the expression passed to
--excludeis using the entire original relative directory path as the original string to match against. So.svn/*by itself doesn't work; the wildcard character in front ensures that it matches.svndirectories anywhere in the directory tree.
The correct expression is -x '*.git*', so the full command should be:
zip -r bitvolution.zip ./bitvolution -x '*.git*'
An explanation from http://selfsolved.com/problems/zip-command-exclude-svn-director:
The correct incantation is
zip -9 -r --exclude=*.svn* foo.zip [directory-to-compress]You can also add a
--exclude=*.DS_Store*to exclude the annoying Mac OS X directory display metadata files.Notice that the expression passed to
--excludeis using the entire original relative directory path as the original string to match against. So.svn/*by itself doesn't work; the wildcard character in front ensures that it matches.svndirectories anywhere in the directory tree.
If you're trying to zip up a project which is stored in Git, use the git archive command. From within the source directory:
git archive -o bitvolution.zip HEAD
You can use any commit or tag ID instead of HEAD to archive the project at a certain point.
If you want to add a prefix (e.g., a top level folder) to every file:
git archive -o bitvolution.zip --prefix=bitvolution/ HEAD
You can also adjust the compression level between 0 (no compression) and 9 (maximum compression) inclusive, for example
git archive -o bitvolution.zip -9 HEAD
For other options, see the help page (git help archive).
How to add man and zip to "git bash" installation on Windows - Stack Overflow
command line - Zip all files in directory? - Unix & Linux Stack Exchange
Zip a git repository directory with `.git` directory included - Stack Overflow
command line - Zip the contents of a folder without including the folder itself - Unix & Linux Stack Exchange
Here's another, slightly different, set of instructions to install zip for git bash on windows:
- Navigate to this sourceforge page
- Download
zip-3.0-bin.zip - In the zipped file, in the
binfolder, find the filezip.exe. - Extract the file
zip.exeto yourmingw64bin folder (for me:C:\Program Files\Git\mingw64\bin) - Navigate to to this sourceforge page
- Download
bzip2-1.0.5-bin.zip - In the zipped file, in the
binfolder, find the filebzip2.dll - Extract
bzip2.dllto yourmingw64\binfolder (same folder as above:C:\Program Files\Git\mingw64\bin)
7-zip can be added to gitbash as follows:
- Install 7-zip on windows.
- add 7-zip folder (
C:\Program Files\7-Zip) toPATH
Ongitbashexp:export PATH=$PATH:"C:\Program Files\7-Zip"(temporary)
On Windows, addingPATHlike image below (permanent)

- duplicate a copy of
7z.exeto bezip.exe - reopen
gitbashagain. done!
This way, it works on my laptop.
If you skip step 3. you still can call zip command as 7z instead of zip
Conclusion: Gitbash is running base on windows Path, I think you can run any command that you have added to your Windows PATH.
You can just use *; there is no need for *.*. File extensions are not special on Unix. * matches zero or more characters—including a dot. So it matches foo.png, because that's zero or more characters (seven, to be exact).
Note that * by default doesn't match files beginning with a dot (neither does *.*). This is often what you want. If not, in bash, if you shopt -s dotglob it will (but will still exclude . and ..). Other shells have different ways (or none at all) of including dotfiles.
Alternatively, zip also has a -r (recursive) option to do entire directory trees at once (and not have to worry about the dotfile problem):
zip -r myfiles.zip mydir
where mydir is the directory containing your files. Note that the produced zip will contain the directory structure as well as the files. As peterph points out in his comment, this is usually seen as a good thing: extracting the zip will neatly store all the extracted files in one subdirectory.
You can also tell zip to not store the paths with the -j/--junk-paths option.
The zip command comes with documentation telling you about all of its (many) options; type man zip to see that documentation. This isn't unique to zip; you can get documentation for most commands this way.
In my case I wanted to zip each file into its own archive, so I did the following (in zsh):
$ for file in *; do zip ${file%.*}.zip $file; done
Compress the git repository using
tar -c -f - foo | gzip >foo.tgz
If you wish to compress the repository without .git directory then run
tar -c --exclude .git -f - foo | gzip >foo.tgz
If your git repository directory contains files that are not versioned and you don't want to include them in the zip file, a simpler alternative is to git clone the repository to a new directory, and compress the whole new directory.