How to set limits for git commits/pushes?

Hi there

I’m sure this isn’t a github issue, but a question:

I’m setting up a gitea server with Postgres. I would like to set up limits for the size of files users can commit and push, 40MB. The app.ini has the following values:

; Whether repository file uploads are enabled. Defaults to `true`
ENABLED = true
; Path for uploads. Defaults to `data/tmp/uploads` (tmp gets deleted on gitea restart)
TEMP_PATH = data/tmp/uploads
; One or more allowed types, e.g. image/jpeg|image/png. Nothing means any file type
; Max size of each file in megabytes. Defaults to 3MB
; Max number of files per upload. Defaults to 5

I’ve set these values to be:

; Whether repository file uploads are enabled. Defaults to `true`
ENABLED = true

However, I’m still able to push and commit files several GB in size. I’ve restarted gitea, and have done make clean and make build several times.

I must be making a mistake: how do I set commit limits?

I think you need to do this via a pre-receive hook. For example… or

Thanks @stu1811

(1) How could I set this up on my own gitea server?

(2) So, what do the fields in [repository.upload] do?

In your gitea-repostories/My_Team/My_Repo.git/hooks create pre-receive and make it executable (chmod +x perceive). Paste in code.

I may be wrong but I think it’s for uploading content to reviews. Attachments are applicable to the Releases.

Thanks @stu1811

I guess I’m still a bit confused: how would this apply to all repos on the server?

Also, do you know how this could work with git lfs?

The hook is a per repo change.

I have not played with LFS. I imagine you can differentiate between the two but I haven’t done it.

Yes, it would be useful to have this for all github repos on the server.

Requested feature:

These settings is only for uploading files from UI, and the limitation is only a limitation one time upload. But not per user.