Skip to content
xuhdev edited this page Oct 31, 2012 · 3 revisions

Install Python If You Don't Have It Installed

Skip this paragraph if you know you have installed Python

Since this script is written in Python, you need to install python first -- however, probably you don't need to do so, since most Linux distributions have it installed by default. If you are unsure whether Python is installed on you computer, run python --version in your shell. If you see a version number printed, that means you have installed Python.

If you haven't installed python, see this page. If you are working on Windows, there is also a video on Youtube teaching you how to install python on Windows.

Download git-archive-all and Use It

First, visit git-archive-all homepage and download the git-archive-all script.

If you are working on a UNIX-like system

Use the make command to put the script to the /usr/local

Or

Give this file execute permission:

chmod +x git-archive-all

Then copy this script to one of your directory in the [PATH environment variable](http://en.wikipedia.org/wiki/PATH_(variable\)) and switch your working directory to the root directory of your Git repository. Run the following command to archive the Git repository and its submodules:

git-archive-all [archive-file-name.format]

If the above command does not work (probably because your Python interpreter executable is installed somewhere other than /usr/bin), try:

python /path/to/git-archive-all [archive-file-name.format]

For example:

git-archive-all my-archive.tar.gz

Then a compressed file my-archive.tar.gz will appear in your working directory. You don't need to specify a compression format like the Git's Archive command -- git-archive-all will decide the format based on the suffix of your file name, such as tar.gz, zip.

If you are working on Windows

Copy this script somewhere, launch Command Prompt and switch the working directory to the root of the Git repository. Then use the following command to archive the Git repository and its submodules:

python X:\path\to\git-archive-all [archive-file-name.format]

For example:

python C:\python_scripts\git-archive-all my-archive.zip

Then a compressed file my-archive.zip will appear in your working directory. You don't need to specify a compression format like the Git's Archive command -- git-archive-all will decide the format based on the suffix of your file name, such as tar.gz, zip.

More

The git-archive-all script has some other powerful features. Don't miss its README.

Edited version of Archive a Git Superproject and Its Submodules by Hong Xu