3

This question is closely related to Git - pack exceeds maximum allowed size, but has an additional twist.

I'm trying to migrate an existing repo to GitHub. Just as in the original question, I get the "pack exceeds maximum allowed size" error. Unfortunately, pushing in chunks of several commits does not solve my problem because the initial commit alone is already too big to go through (~6000 files, ~1GiB). The project existed for several years before all its files finally got moved into a git repo.

Is there a way to somehow split the first commit for the sake of pushing it to GitHub (without changing the entire history of the project)? What else could I do?

Cœur
  • 37,241
  • 25
  • 195
  • 267
flow-c
  • 31
  • 3
  • *without changing the entire history of the project* - unfortunately, no. Moreover, as long as the history contains this much data, you will have big pack files. I am no GitHub expert but it sounds like the first line solution would be buying a bigger allowed size there, if that's possible. – torek Jun 19 '17 at 16:47
  • Perhaps `git repack --max-pack-size=<>` may be of some help here. You might also want to contact GitHub support about this. – Pockets Jun 19 '17 at 17:37

1 Answers1

1

Git 2.33 (Q3 2021) is now clearer regarding git repack --max-pack-size=....

See commit 6fb9195 (08 Jun 2021) by Jeff King (peff).
(Merged by Junio C Hamano -- gitster -- in commit 18b49be, 08 Jul 2021)

doc: warn people against --max-pack-size

Signed-off-by: Jeff King

This option is almost never a good idea, as the resulting repository is larger and slower (see the new explanations in the docs).

I outlined the potential problems.
We could go further and make the option harder to find (or at least, make the command-line option descriptions a much more terse "you probably don't want this; see pack.packsizeLimit for details").
But this seems like a minimal change that may prevent people from thinking it's more useful than it is.

git config now includes in its man page:

Note that this option is rarely useful, and may result in a larger total on-disk size (because Git will not store deltas between packs), as well as worse runtime performance (object lookup within multiple packs is slower than a single pack, and optimizations like reachability bitmaps cannot cope with multiple packs).

If you need to actively run Git using smaller packfiles (e.g., because your filesystem does not support large files), this option may help.

But if your goal is to transmit a packfile over a medium that supports limited sizes (e.g., removable media that cannot store the whole repository), you are likely better off creating a single large packfile and splitting it using a generic multi-volume archive tool (e.g., Unix split).

The minimum size allowed is limited to 1 MiB. The default is unlimited. Common unit suffixes of 'k', 'm', or 'g' are supported.

git pack-objects now includes in its man page:

Note that this option may result in a larger and slower repository; see the discussion in pack.packSizeLimit.

git repack now includes in its man page:

Note that this option may result in a larger and slower repository; see the discussion in pack.packSizeLimit.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250