d7l2k4
d7l2k4

Reputation: 175

Git Push remote: fatal: pack exceeds maximum allowed size

I received a large project. Client wanted to add it to github.

I was adding bit by bit. Then what happened was I got greedy and added too many files at once. Now, no matter what I try, I keep getting this error. How can I fix this? I tried to roll back but maybe I did it wrong.

$ git push
Enter passphrase for key '/c/Users/guestaccount/.ssh/id_rsa':
Enumerating objects: 35931, done.
Counting objects: 100% (35931/35931), done.
Delta compression using up to 12 threads
Compressing objects: 100% (35856/35856), done.
remote: fatal: pack exceeds maximum allowed size
fatal: sha1 file '<stdout>' write error: Broken pipe
error: remote unpack failed: index-pack abnormal exit
To github.com:(mygithubid)/(repo).git
 ! [remote rejected]   main -> main (failed)
error: failed to push some refs to 'github.com:(mygithubid)/(repo).git'

I am using Visual Studio Code and git bash to upload.

Upvotes: 8

Views: 22513

Answers (2)

gagafonov
gagafonov

Reputation: 1

in gitlab you can set this up in the "Account and limit settings" section https://docs.gitlab.com/ee/administration/settings/account_and_limit_settings.html – "Maximum push size (MiB)" parameter

Upvotes: 0

VonC
VonC

Reputation: 1327174

First, you can use git-sizer to get an idea of what is taking too much space in your current local repository (that you fail to push)

  • if it is because of a commit too big, you can:

    • git reset @~ to cancel that commit
    • remake several smaller commits
    • try and push again
  • if it is because of a file too big, you can try and activate Git LFS, but that is limited by quota and going above might include a non-free service.

More generally, a "large project" might need to be split up into several Git repositories.


Note tat, with Git 2.36 (Q2 2022), when "index-pack" dies due to incoming data exceeding the maximum allowed input size, it will include the value of the limit in the error message.

You will be able to split your commits more effectively knowing the remote limit. (Assuming the remote server does use Git 2.36+)

See commit 0cf5fbc (24 Feb 2022) by Matt Cooper (vtbassmatt).
(Merged by Junio C Hamano -- gitster -- in commit 283e4e7, 06 Mar 2022)

index-pack: clarify the breached limit

Helped-by: Taylor Blau
Helped-by: Derrick Stolee
Signed-off-by: Matt Cooper

As a small courtesy to users, report what limit was breached.
This is especially useful when a push exceeds a server-defined limit, since the user is unlikely to have configured the limit (their host did).

    if (max_input_size && consumed_bytes > max_input_size) {
        struct strbuf size_limit = STRBUF_INIT;
        strbuf_humanise_bytes(&size_limit, max_input_size);
        die(_("pack exceeds maximum allowed size (%s)"),
            size_limit.buf);
    }

Upvotes: 13

Related Questions