gitea/gogs在push操作时报RPC failed的问题

原文发布于:https://www.chenxublog.com/2019/05/26/gitea-gogs-push-rpc-failed.html

最近川普在搞出口管制,GitHub也更新了相应的条款,为了防止自己的代码出什么问题,就自己搭建了一个gitea用来镜像自己所有在GitHub上面的项目

不过在push一个一百多M大小的仓库时,报了这样的错误:

git.exe push --progress "2" master:master

Enumerating objects: 768, done.
Counting objects: 100% (768/768), done.
Delta compression using up to 4 threads
Compressing objects: 100% (455/455), done.
Writing objects: 100% (768/768), 57.69 MiB | 84.16 MiB/s, done.
Total 768 (delta 316), reused 708 (delta 290)
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
Everything up-to-date


git did not exit cleanly (exit code 1) (1938 ms @ 2019/5/26 22:08:16)

bing搜了一下,网上常见的解决方法都是更改http.postBuffer的大小,但是没什么效果

后来在GitHub发现了这个:https://github.com/go-gitea/gitea/issues/5805#issuecomment-477523202

简单来说就是nginx的上传大小限制太小了(默认的),改大就可用了:

server
{
    listen 80;
    listen 443 ssl http2;
    server_name git.papapoi.com;
    client_max_body_size 100M; # Push large objects to gitea
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/git.papapoi.com;
    
    #其他设置.....
}

问题完美解决

posted @ 2019-08-30 11:22 晨旭~ 阅读(...) 评论(...) 编辑 收藏