gfdxy3322 发表于 2018-9-19 10:53:30

Gitlab RPC failed; result=22, HTTP code = 413 解决方法

  说明:
  最近项目组有同事遇见了一个gitlab push 的问题
  其报错如下:
  Counting objects: 21230, done.
  Delta compression using up to 3 threads.
  Compressing objects: 100% (20814/20814), done.
  Writing objects: 100% (21230/21230), 632.97 MiB | 9.89 MiB/s, done.
  Total 21230 (delta 9495), reused 0 (delta 0)
  error: RPC failed; result=22, HTTP code = 413
  fatal: The remote end hung up unexpectedly
  fatal: The remote end hung up unexpectedly
  Everything up-to-date

  经过了解后,root case 为 push 过大,超过单个文件上传默认限制:

[*]  gitlab 默认commit 文件为5M
[*]  gitlab默认上传文件最大10M
[*]  nginx.conf 默认配置无lient_max_body_size
  解决方式:
  一、服务端配置修改(修改配置的时候请一定要备份)
  1.修改 gitlab/config/gitlab.yml 配置文件187行:
      $ vigitlab/config/gitlab.yml
  2.修改 gitlab/app/models/note.rb 配置文件39行:
      $ vi gitlab/app/models/note.rb
  3.修改 /usr/local/nginx/conf/nginx.conf 配置文件,在http模块内添加一行配置:
      # vi /usr/local/nginx/conf/nginx.conf
  4.重启gitlab服务 和 nginx 服务
      # /etc/init.d/gitlab restart  
      # /etc/init.d/nginx restart
  二、客户端配置
  windows / 插件下:
  编辑 git全局配置,添加配置:
  
  receivepack = true
  postBuffer = 524288000

  linux / 命令行 下:git config http.postBuffer 524288000
  然后就可以推送大文件了(60M) ,但是不建议开启这么大的文件传输限制,其中原因想必大家懂得 。

  关于gitlab ,请大家多多交流,共同进步哦 ~~~


页: [1]
查看完整版本: Gitlab RPC failed; result=22, HTTP code = 413 解决方法