0

Tar extract doesn't work on Zip repos with submodules:

curl -L https://github.com/org/repo-with-submodules/archive/refs/heads/main.zip -o ~/Downloads/repo-main.zip
tar -xvf ~/Downloads/repo-main.zip -C ~/Downloads
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100     9  100     9    0     0     27      0 --:--:-- --:--:-- --:--:--    27
tar: Error opening archive: Unrecognized archive format

Tar should be installed in Mac and Debian by default.

How to achieve without using Zip, Unzip?

3
  • Does TAR work on other zip files, or similarly constructed zip files from other sources? Commented Jun 12 at 18:54
  • DO you have java installed? Commented Jun 12 at 19:47
  • Do your environments have bsdtar installed?
    – Daniel B
    Commented Jun 13 at 7:44

1 Answer 1

2

The zip archive format is completely different from the tar archive format, and the tar tool does not handle zip archives.

There are programs other than zip and unzip that can handle zip archives. 7-zip is one such program. There may be others.

When unarchiving a github zip file with submodules, the submodules themselves are not included in the archive. Instead, a stub file with a .wrap extension is included that contains a URL of the location of the submodule. unzip extracts these stub files from the archive, but the actual modules are not extracted because they are not present in the archive.

1
  • Only the last paragraph here is relevant to the question, I think, and it doesn't do anything to actually answer the question that was asked. Commented Jun 14 at 0:09

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