'How to archive a git repository for long term storage?

I am in possesion of a large number of mostly small git repositories. These come from a variety of sources with wildly different complexities, ranging from a couple of commits on a single branch, up to hundreds of commits with tens of branches. All these repositories are entirely local, with their upstream repositories being either non-existant or long dead.

I want to archive the repos for long term storage, similar to cold storage. My goal is to preserve as much information about the repo as possible, in as few bytes as possible.

So far, I've been following the same idea for all repos: run git gc --aggressive and then drop only the .git directory in a 7z archive, while discarding the rest. This method has the advantage of being a carbon copy of a repo, with quite decent compression, stored in a single file, but it just doesn't seem like a "proper" solution. What if 7zip would compress the .pack files more efficiently?

So, is there a more "proper" way of archiving a git repo?

Thanks!

git


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source