How do I export my project as a .zip of git repository?

GitZipExport

Git Problem Overview


I was recently asked to export as a .zip file one of my projects on my Git repository.

I have actually never had to do this in the 4 years I have been using Git.

I would prefer an answer that is all done inside command line terminal.

Git Solutions


Solution 1 - Git

git archive --format zip --output /full/path/to/zipfile.zip master

Solution 2 - Git

Following code might help if you want to include .git/ too and don't want to include other extra files which haven't been tracked by git. Suppose the path of your git project is /opt/some-project/, commit whatever are left, then you can do as the following:

git clone /opt/helloworld/  folder2
cd folder2
tar -czf helloworld-latest.zip folder2

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDanielView Question on Stackoverflow
Solution 1 - GitEncryptedWatermelonView Answer on Stackoverflow
Solution 2 - GitIcebergView Answer on Stackoverflow