Fatal error pushing to Heroku on macOS with git/2.39.3 (Apple Git-146)

Issue

The recent version of Git included with macOS (git/2.39.3 (Apple Git-146) may cause git push heroku to fail with errors such as fatal: protocol error: bad line length character: fata and fatal: the remote end hung up unexpectedly:

Enumerating objects: 14718, done.
Counting objects: 100% (14718/14718), done.
Delta compression using up to 16 threads
Compressing objects: 100% (6495/6495), done.
fatal: protocol error: bad line length character: fata
Writing objects: 100% (14718/14718), 17.62 MiB | 1007.00 KiB/s, done.
Total 14718 (delta 7769), reused 14137 (delta 7392), pack-reused 0
fatal: the remote end hung up unexpectedly
error: failed to push some refs to 'https://git.heroku.com/example.git'

Resolution

To resolve the issue, use a newer version of Git. Please use any of the methods outlined in https://git-scm.com/download/mac, except the Xcode method which includes this issue.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support