1
% 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).

1
  • What error are you getting when you run 7zip and what is the command you are using for extraction?
    – vgoff
    Aug 9, 2013 at 13:15

2 Answers 2

2

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.

0
$: 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.
4
  • 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. Aug 9, 2013 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, 2013 at 15:44
  • I do not want to backup bitbucket project! I want to back up my servers' config this way. Aug 9, 2013 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, 2013 at 4:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .