Skip to content

Instantly share code, notes, and snippets.

@simonw
Last active January 11, 2025 07:19
Show Gist options
  • Save simonw/a44af92b4b255981161eacc304417368 to your computer and use it in GitHub Desktop.
Save simonw/a44af92b4b255981161eacc304417368 to your computer and use it in GitHub Desktop.
How to create a tarball of a git repository using "git archive"
@yskelg
Copy link

yskelg commented Jun 30, 2024

This solution available.

wget https://github.com/torvalds/linux/archive/refs/heads/master.zip

This previous solution was not available(why?)

$ wget https://github.com/User/repo/archive/master.tar.gz
--2024-06-30 15:22:42--  https://github.com/User/repo/archive/master.tar.gz
Resolving github.com (github.com)... 20.200.245.247
Connecting to github.com (github.com)|20.200.245.247|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2024-06-30 15:22:42 ERROR 404: Not Found.

@winston0410
Copy link

Git 2.44 or above support HTTP protocol for git archive, so you can probably create an archive from remote directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment