Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
% git archive --format tar master > archive.tar
% file archive.tar
archive.tar: POSIX tar archive

% tar cf a.tar archive.tar
% file a.tar
a.tar: POSIX tar archive (GNU)

7zip cannot unpack tar archive created by "git archive". Apparently there are some differences.

The reason I'm asking is that I would like to be able to unpack tar archive from git on Windows and 7zip is great utility. Is there some flag/workaround (short of unpacking tar archive created by git and packing it with GNU tar).

share|improve this question

migrated from serverfault.com Aug 9 '13 at 17:12

This question came from our site for professional system and network administrators.

    
What error are you getting when you run 7zip and what is the command you are using for extraction? –  vgoff Aug 9 '13 at 13:15
add comment

2 Answers 2

up vote 2 down vote accepted

git-archive only creates PAX tar archives, and 7-Zip is incapable of reading PAX tar archives. Either use a different format with git-archive, post-process the archives created to recompress using tar, or use a different tool under Windows.

share|improve this answer
add comment
$: git archive --list
tar
tgz
tar.gz
zip

Do you get zip listed in the available archive list? Couldn't you simply use zip rather than tar to create them?

If you are using git for doing your archiving, you may wonder that there is not a way to extract the archive using the same tool. We are in luck, as there is, from the man pages:

git-get-tar-commit-id(1)
       Extract commit ID from an archive created using git-archive.
share|improve this answer
    
Sure I can (actually I do now). Except I want to back up a relatively large number of files periodically (bitbucket.org/mrkafk/configbackup/wiki/Home) and so using bzip2 for compression would be preferable. –  John Doe Aug 9 '13 at 13:55
    
They are already on bitbucket, and they are on your local repository. How many backups do you need? Really, just create another repository and maybe just package them with your 7zip after you fetch the repository? –  vgoff Aug 9 '13 at 15:44
    
I do not want to backup bitbucket project! I want to back up my servers' config this way. –  John Doe Aug 9 '13 at 15:58
    
Ah, you had given a bitbucket link as instructions rather than the object in question. Sorry, I had misunderstood the goal. I thought it was a git repository that could be easily pushed and pulled as a way to back up the files inherently. With bitbucket as the chosen host. Updating answer, to avoid 7zip using git tools. –  vgoff Aug 10 '13 at 4:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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