今天前端人員提交代碼時,出現了以下奇怪錯誤:前端
$ 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