Igor Khromov blog

How to split existing *.zip file to parts or archive file and split it to parts

Sometimes we need to split zip file into parts, known use case is Github, so if you try to push commit with file that has size more than 100Mb, Github will deny commit with message:

remote: error: Trace: 5b7ebc3f284af151458d0298cfab37dd4c8ac98a58d6c229fdc3bf103e9919f8
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File source-archive.zip is 379.27 MB; this exceeds GitHub's file size limit of 100.00 M
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
To github.com:xrom888/some-repop-with-archive.git
 ! [remote rejected] develop -> develop (pre-receive hook declined)

So we need some workaround here. For example we can split zip file to parts to GitHub happy ).

For this purpose we can use on Mac or Linux command line util “zip”.

Option #1. Split zip file to parts with max size of 100 Mb, we need to run:

zip source-archive.zip --out target-archive.zip -s 100m

Option #2. Split unarchived file to parts with max size of 100 Mb, we need to run:

zip target-archive.zip source-file.txt -s 100m

To unzip parts back to original file, we need execute:

# Concat parts to one file
zip -s 0 target-archive.zip --out source-archive.zip

# Unzip created file
unzip source-archive.zip

How to install “zip, unzip” unit on Mac – zip brew formulae, unzip brew formulae:

brew install zip unzip