Corrupted archives

Hello,
I have a strange issue when I add archive files (whether tar.gz or zip) to my repository.
when I pull back those archives they are always corrupted : tar shows issue with the header, while 7-zip is reporting CRC failed.
I’m under windows and I have the same issue with different GUI (Sourcetree, tortoiseGit, Git extensions)

what am I doing wrong?
Regards,
Rocco

Most likely you have something that mangles files as they get added. For example on Windows it’s common to enable line ending modifications. If that happens to a binary file it’s likely to get broken. Check your Git config and especially .gitattributes for any such settings.

That said, in general it’s a bad idea to add archive files to a Git repository. They can’t be diffed and merged, and they don’t compress efficiently. Usually it’s better to add the files the archive is built from (source code, etc.).

thanks very much for the quick reply.
I have opted for the archive as adding the files individually would raise another issue where the file permissions are lost. creating an archive (in particular tar with -p flag) would preserve file permissions

Without knowing more about your project it’s hard to say how to best approach that. Git does preserve executable flags (but how to set them on Windows isn’t super obvious). If you need more I’m starting to think Git might either not be the right tool for the job, or there’s something weirdly convoluted going on. Or maybe you need an install procedure?

Anyway, this seems like the kind of problem where you should take a step back and look at the big picture of what you’re actually trying to achieve. Not “put this archive into Git”, but rather the core problem you’re trying to solve.