Cannot push files larger than 1 MB from macOS

Using:

  • macOS Big Sur Version 11.3.1 (20E241).
  • git version 2.30.1 (Apple Git-130)

I cannot push .csv files that are larger than 1 MB to GitHub.com repositories. I get a very cryptic error message, namely:

Enumerating objects: 51, done.
Counting objects: 100% (51/51), done.
Delta compression using up to 16 threads
Compressing objects: 100% (26/26), done.
send-pack: unexpected disconnect while reading sideband packet
Connection to github.com closed by remote host.
fatal: the remote end hung up unexpectedly

Please see this post regarding why you can’t, and what those errors mean:

@tajmone thanks for the quick response on this issue. I’m not sure why Git LFS would be necessary here. I understand that there’s some issue with the size of the files I’m trying to upload, but I’m uploading 1 file that is 1.2 MB, which should be well within the technical limits.

I’m sorry, I’ve misread Gb instead of Mb. (forgive me, I have vision problems that make it hard to focus on the letters sometimes.

No worries! I wouldn’t mind setting up Git LFS, but it just seems like overkill in this situation.

Since the problem reports disconnection problems, may I ask how long the compression part takes? does the operation seem long enough to justify a timeouts?

See also this StackOverflow discussion:

The compression part is very fast. It does not seem like it should timeout at all.

I tried all of the instructions on that StackOverflow discussion, and nothing seems to be working. I tried increasing the http.postBuffer, but that doesn’t do anything.

The problem is that, as the SO thread reveal, this type of error seems to be caused by so many different factors, not all of them related to each other.

The only other thing that comes to my mind is Unicode characters in files names (or repository/branches names). I’ve read that macOS requires some extra Git settings to ensure correct Unicode normalization in files names. But since you mentioned that you’re using the Apple-supplied version of Git, I’d expect those settings to be in place.

You could always try to replace the native Git with the latest official Git distribution. The macOS Git version usually lags behind the official one by a few MINOR bumps, so you won’t be loosing but gaining. Also, reverting to Apple’s Git distro should be easy too, and installing and uninstalling Git shouldn’t make you lose any settings either.