Published: 13.06.2020 | Edited: 22.12.2020 | Tags: linux,nginx,git
How to enable Git LFS on gitea over nginx reverse proxy
When setting up gitea server behind a nginx reverse proxy, you might come to the problem when pushing files tracked in LFS that presents itself as a following error:
HTTP/1.1 413 Request Entity Too Large
The error itself does not specifically hint which component might be causing the trouble. Searching the internet proven to be fruitful, however the solution I have found seemed like it is not related to the problem.
It boils down to the fact, that by default (without setting the size limit explicitly), the limit is 1MB, as can be seen in the docs. The steps from the solution provided by the Atlassian are following:
Edit your nginx configuration - the location may be different in your setup:
# vi /etc/nginx/nginx.conf
Set the size limit, in my case under
nginx -s reload
Make sure that the size is greater than
LFS_MAX_FILE_SIZE in your
app.ini gitea config, if set to anything other than 0 (no limit). You can read more about gitea config in the cheatsheeet.
I have later found that there is also a closed issue that is related to the maximum size, but it is not related to LFS push, and the suggested config also differs from mine.