I'm running the following command to download a single file from git:

git archive --remote=ssh://host/pathto/repo.git HEAD README.md

The contents of the file are directed to terminal, before I see the contents of the README I have some header information, that looks like this:

pax_global_header00006660000000000000000000000064131063477050014520gustar00rootroot0000000000000052 comment=502c8004562eab49c105b2e294d8806c735c13a1 README.md000066400000000000000000000002771310634770500123510ustar00rootroot00000000000000

My end goal is to redirect the file locally like so:

git archive --remote=ssh://host/pathto/repo.git HEAD README.md > README.md

How do I deal with the header information so I end up with files that don't contain the header as text?


I found that piping into tar xvf - solved the issue:

git archive --remote=ssh://host/pathto/repo.git HEAD README.md  |  tar xvf -

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.