Git error: RPC failed; result=22, HTTP code = 411 的解决办法

最近在使用 HTTP 方式向 Git 远程仓库 Push 数据的时候,偶发的会遇到以下错误:

Counting objects: 657, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (438/438), done.
error: RPC failed; result=22, HTTP code = 411
fatal: The remote end hung up unexpectedly
Writing objects: 100% (447/447), 3.62 MiB | 0 bytes/s, done.
Total 447 (delta 233), reused 0 (delta 0)
fatal: The remote end hung up unexpectedly
Everything up-to-date

解决的办法是,在终端里执行:

git config http.postBuffer 524288000

原因:默认 Git 设置 http post 的缓存为 1MB,上述代码将其设置为 500MB~

参考: