# Setting file size limit similar to github

**URL:** <https://forum.gitea.com/t/setting-file-size-limit-similar-to-github/2393>\
**Category:** Install/Maintain/Configure\
**Created:** [August 7, 2020, 9:38pm UTC](https://forum.gitea.com/t/setting-file-size-limit-similar-to-github/2393 "2020-08-07T21:38:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![penguin](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@penguin](https://forum.gitea.com/u/penguin)\
**Post date:** [August 7, 2020, 9:38pm UTC](https://forum.gitea.com/t/setting-file-size-limit-similar-to-github/2393/1 "2020-08-07T21:38:24Z")

</div>

Hi, I’m new to hosting servers so this may be super obvious. But I can’t figure out how to set a max file size on gitea. It says in the documentation that I can list “MAX\_FILE\_SIZE” under [indexer], but I tried this and restarted my server and nothing happened. Then I tried:

> [indexer]  
> REPO\_INDEXER\_ENABLED = true  
> REPO\_INDEXER\_PATH = indexers/repos.bleve  
> UPDATE\_BUFFER\_LEN = 20  
> MAX\_FILE\_SIZE = 1048576  
> REPO\_INDEXER\_INCLUDE =

and restarted my server and still nothing happened. Not exactly sure what I’m doing. Does anyone know how to do this?

---

<div class="post-metadata">

**Author:** ![techknowlogick](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/techknowlogick/32/4706_2.png) [@techknowlogick](https://forum.gitea.com/u/techknowlogick)\
**Post date:** [August 11, 2020, 4:17pm UTC](https://forum.gitea.com/t/setting-file-size-limit-similar-to-github/2393/2 "2020-08-11T16:17:56Z")

</div>

The indexer is used for code search, and the max file size setting there is to determine the max file size of files to be indexed. If you don’t wan’t files over a certain size committed to your instance you are able to use githooks to prevent that (please note, you should only have trusted users modify githooks)

---

<div class="post-metadata">

**Author:** ![penguin](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@penguin](https://forum.gitea.com/u/penguin)\
**Post date:** [October 4, 2020, 6:09pm UTC](https://forum.gitea.com/t/setting-file-size-limit-similar-to-github/2393/3 "2020-10-04T18:09:05Z")

</div>

Thank you for the response. I am new to self-hosting a git server so please forgive my ignorance. Is there a guide on implementing web-hooks for all users so I may limit the file size of files as they are committed, or even maybe as they are being uploaded? My main issue is that I want things over 500MB ish to be capped so users are forced to use git-lfs. Is this a bad approach? I just want to make sure users can’t upload junk files in bulk maliciously.
