git push 报错:error: RPC failed; result=22, HTTP code = 413 fatal: The remote end hung up unepectedly

  table of Contents

1. Problem description

Two, the solution

2.1 Method 1: Change the transmission method from http to ssh (recommended)

2.2 Modify the submission cache size to 500M or greater

2.3 Set git minimum speed and minimum speed time

Three, summary

Four, reference link


1. Problem description

The following errors may occur when git pushes:

error: RPC failed; result=22, HTTP code = 413
fatal: The remote end hung up unepectedly 

The main reason for this error is that the transmitted content is relatively large.

Two, the solution

The tests in this article are based on my newly created github warehouse My_String as an example, in which the http method is used to clone the warehouse.

2.1 Method 1: Change the transmission method from http to ssh (recommended)

If you are using http transmission, change it to ssh transmission.

(1) Use git remote -v to check your connection and confirm that the HTTP method is currently used, as shown below:

[root@bogon My_String]# git remote -v
origin  https://github.com/New-World-2019/My_String.git (fetch)
origin  https://github.com/New-World-2019/My_String.git (push)
[root@bogon My_String]#

2. Copy the ssh connection in the github My_String warehouse, as shown below:

3. Modify the transmission method http to ssh, execute the command git remote set-url origin "SSH connection", as shown below:

[root@bogon My_String]# git remote set-url origin [email protected]:New-World-2019/My_String.git
[root@bogon My_String]# git remote -v
origin  [email protected]:New-World-2019/My_String.git (fetch)
origin  [email protected]:New-World-2019/My_String.git (push)
[root@bogon My_String]#

After the change, normal push is fine.

2.2 Modify the submission cache size to 500M or greater

Execute the command git config --global http.postBuffer Size to set it as follows:

[root@bogon My_String]# git config --global http.postBuffer 524288000
[root@bogon My_String]# git config --global http.postBuffer 1048576000

2.3 Set git minimum speed and minimum speed time

Execute the command git config --global http.lowSpeedLimit Time to set it as follows:

[root@bogon My_String]# git config --global http.lowSpeedLimit 0
[root@bogon My_String]# git config --global http.lowSpeedTime 999999

Three, summary

I recommend using the first method. The other two methods treat the symptoms but not the root cause. In addition, it is recommended not to transfer unused/unimportant/executable files to the warehouse. This can be filtered under the warehouse. git ignore, if not Just create a new one.

Four, reference link

[1] https://blog.csdn.net/weixin_38450840/article/details/80701173

[2] https://blog.csdn.net/WangYouJin321/article/details/106329757

Guess you like

Origin blog.csdn.net/u011074149/article/details/108818608