今天前端人员提交代码时,出现了以下奇怪错误:前端
$ git push origin Counting objects: 4, done. Delta compression using up to 24 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 5.59 MiB | 16.73 MiB/s, done. Total 4 (delta 1), reused 0 (delta 0) error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500 Internal Server Error fatal: The remote end hung up unexpectedly fatal: The remote end hung up unexpectedly Everything up-to-date
一看,6MB不到的文件竟然提交失败,以前20M的文件都提交过.nginx
网上搜了下,大可能是说使用git config --global http.postBuffer 524288000
将本地http的缓存加大到500MB,但试了下,依旧是这样的错误.因而翻了下gitlab的官方Issue.找到两个:git
第一个Issue是说Gitlab中的配置须要修改,个人gitlab是跑在容器中,所以修改gitlab与nginx限制:bash
gitlab/config/gitlab.rb
,修改了gitlab_rails['git_max_size'] = '524288000'
,增长到500MB.curl
nginx['client_max_body_size'] ='0'
,关闭nginx对上传内容的长度限制.gitlab
遗憾的是依旧无效.post
第二个Issue中大伙挨个分析了错误的响应,并给出了几个解决办法,遗憾的依旧无效.url
我对着日志挨个检查了一遍,发现错误在logs/nginx/gittlab_error.log
中,错误内容为:
[crit] 468#0: *101 open() "/var/opt/gitlab/nginx/client_body_temp/0000000001" failed (13: Permission denied) ... ...
看到这条便恍然,前两天将gitlab服务迁移到群晖下后,是文件夹权限变动致使的.所以git push文件时,size比较小的文件好比2K或者3K的代码提交很快,由于nginx根本不缓存.可是当文件只要稍大时,nginx必将缓存一下,这时权限问题便出现.
所以修改一下权限便可: nginx/client_body_temp/
权限改成** 0700 **.
If you move gitlab's data
folder, please check logs/nginx/gittlab_error.log
,and in most cases, /var/opt/gitlab/nginx/client_body_temp/
Permission denied . So,just change client_body_temp
permission to 700
:
chmod 700 data/nginx/client_body_temp