Bootstrap FreeKB - Git (Version Control) - Create an archive (zip gzip bzip2)
Git (Version Control) - Create an archive (zip gzip bzip2)

Updated:   |  Git (Version Control) articles

The most basic way to use Git is to use the git clone command to clone an origin Git repository (such as example.git) to a directory on your PC (such as /home/john.doe/git), make a change to a file in the cloned repository on your PC (such as example.txt), use the git commit command to commit the change to the file, and to then use the git push command to upload the file to the origin Git repository.

 

The git archive command can be used to create an archive, such as zip, gzip, or bzip2 archive. In this example, a gzip archive named example.tar.gz is created of the master branch of the foo.git repository.

git archive --remote ssh://git@example.com/path/to/foo.git master --format tar.gz --output /path/to/example.tar.gz

 

Or like this.

git archive --remote ssh://git@example.com/path/to/foo.git master | gzip > example.tar.gz

 

Let's say the foo.git repository contains two directories, "foo" and "bar". Here is how you could create an archive of only the "bar" directory.

git archive --remote ssh://git@example.com/path/to/foo.git master bar/ | gzip > example.tar.gz

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 6bde11 in the box below so that we can be sure you are a human.