git archive --format=tar.gz -o /tmp/my-repo.tar.gz --prefix=my-repo/ master
More detailed version: https://til.simonwillison.net/git/git-archive
git archive --format=tar.gz -o /tmp/my-repo.tar.gz --prefix=my-repo/ master
More detailed version: https://til.simonwillison.net/git/git-archive
This works on git repositories that are not Github
git archive --format=tar.gz -o my-repo.tar.gz --remote=git://sourceware.org/git/glibc.git master
Note that it doesn't work on Github as it appears it doesn't support it isaacs/github#554
for subfolder not work please solve download github subfolder project
example
wget https://github.com/User/repo/archive/master/folder.tar.gz
not work return 404 error please solve or propose solution for work
download github subfolder project in tarball
thank you
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.
Git 2.44 or above support HTTP protocol for git archive
, so you can probably create an archive from remote directly.
Just putting this here, it's not ideal but if you have a private repo and just want to fetch it:
Generate GitHub access token: https://github.com/settings/tokens
And use token like this:
https://<personal_token>:@github.com/<your_repo>/archive/main.tar.gz
It's no ideal solution as you will have to recreate the token over time and each dev who wants to use the repo needs their own token.