「Gogs」- 常见错误汇总 @20210418
fatal: the remote end hung up unexpectedly / 413 Request Entity Too Large
问题描述
# git push -u origin master Enumerating objects: 15899, done. Counting objects: 100% (15899/15899), done. Delta compression using up to 4 threads Compressing objects: 100% (8080/8080), done. error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large fatal: the remote end hung up unexpectedly Writing objects: 100% (15899/15899), 75.80 MiB | 102.40 MiB/s, done. Total 15899 (delta 8964), reused 13944 (delta 7312) fatal: the remote end hung up unexpectedly Everything up-to-date
问题原因
看到错误日志中的 413 Request Entity Too Large 提示,我们就立刻想到是 Nginx 配置原因。通常较大的仓库会遇到该问题。
解决办法
在 Nginx 中,添加 client_max_body_size 配置:
server { listen 80; server_name gogs.example.com; client_max_body_size 200m; location / { proxy_pass http://127.0.0.1:6000; } }