How do I pipe a git clone to archive (tar or gzip)
You can use git archive
for this purpose with the --remote
option.
You can pipe it to create zip or tar or whatever you like.
Please, see the git-archive(1) manual page.
No you cannot just pipe git clone
because it does not write it out to the standard output. And why do you need a one-liner? They are great for boasting that you can do something cool in just one line, but not really ideal in real world.
You can do something like below, but you would not get .git
like you would in a git clone
:
git archive --format=tar --remote=git@server:repo.git master | tar -xf -
From git archive
manual
--remote=<repo>
Instead of making a tar archive from the local repository, retrieve a tar archive from a remote repository.