In GitHub there is a default file size limit which is 50 MB, it will not allow me to commit a file >50MB. Can I enforce the same in GitLab?
CodePudding user response:
There are few ways this can be configured to prevent large files from being committed:
Push Rules (Premium)
If you have a Premium or Ultimate subscription, you can configure
For self-managed instances, this can also be managed instance-wide under Admin Area -> Push Rules.
Instance limit settings (self-managed only)
Administrators of self-managed GitLab instances can also set limits on an entire GitLab instance. To do this effectively, two settings must be configured in the admin area:
- Max push size this limits the size of files that can be pushed using git
- For files added through the web UI, the max attachment size setting must also be greater than or equal to the max push size.
Similar to push rules, this does not apply to files added through LFS.
In all cases, file sizes are, of course, also limited by global storage limits for projects, which includes all git storage, LFS, artifacts, etc.
Alternative: client-side hooks
As an alternative to settings enforced by gitlab, users can also configure local git hooks to prevent committing large files. Of course, this requires users to set this up correctly for each repository locally and isn't enforced by GitLab.