Gitlab-error: RPC failed; result=22, HTTP code = 500

created at 07-12-2021 views: 19

In the process of operating Gitlab for daily code push and pull, I suddenly encountered an exception as described in the title. This blog records the solution to this problem

Scene recurrence

The code push operation on the Gitlab private warehouse produces the following exception information:

Counting objects: 875, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (523/523), done.
Writing objects: 100% (875/875), 42.94 MiB | 9.72 MiB/s, done.
Total 875 (delta 206), reused 2 (delta 0)
error: RPC failed; result=22, HTTP code = 500
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly

Gitlab official feedback information on this issue: here

After checking the official issue, you can find that the official solution to this problem is basically the following two solutions:

  1. Change CentOS operating system to Ubuntu
  2. Change Nginx engine to Tomcat

The operating cost of both schemes is very expensive and unacceptable

Cause of the problem

Because gitlab itself encapsulates tools such as nginx, redis, and the configuration of these tools is also resolved, so in the process of pushing the code, if the commit volume submitted at one time is too large and exceeds the limit value of max package, it may be Produces the above exception

It's definitely not a problem with nginx or the operating system itself

But changing the gitlab configuration is a very troublesome thing, so here is another way of thinking: we do not rely on the http protocol for uploading, switching to the ssh protocol can bypass this problem

New solution

New solution: change the submission method to ssh

Specific steps:

1 Submit the public key to the Gitlab account

2 Change project remote address
Use the command git remote -v in the project path. 

If you upload the code in the form of http/https, the address format is similar to: 

gitlab http://${your domain name}/liumapp/${your project name}.git (fetch)

What we have to do is to change it to upload in ssh format, and change the address to something like:

gitlab git@github.com:liumapp/${your project name}.git

Operation command 

git remote set-url gitlab git@${your domain name}:liumapp/${your project name}.git 

By the way, please replace the liumapp that appears above with your own gitlab account name.

3 Use ssh to push code, git push, problem solving

created at:07-12-2021
edited at: 07-12-2021: