In my case, this error occurred because I attempted to push a file size of 30MB. We resolved this issue by increasing Git’s HTTP buffer size to accommodate larger pushes. Say we set the size to 150mb, using the following command:
git config --global http.postBuffer 150000000
git config --global --get http.postBuffer
After entering these two lines, our push should work successfully.