Snippets
- Tier: Free, Premium, Ultimate
- Offering: GitLab Self-Managed
You can configure a maximum size for a snippet to prevent abuse. The default limit is 52428800 bytes (50 MB). The limit is applied when a snippet is created or updated. The limit does not affect existing snippets unless they are updated and their content changes.
Configure the snippet size limit
To configure the snippet size limit, you can use the Rails console or the Application settings API.
The limit must be in bytes.
This setting is not available in the Admin area settings.
Use the Rails console
To configure this setting through the Rails console:
Update the snippets maximum file size:
ApplicationSetting.first.update!(snippet_size_limit: 50.megabytes)
To retrieve the current value, start the Rails console and run:
Gitlab::CurrentSettings.snippet_size_limit
Use the API
To set the limit by using the Application Settings API (similar to updating any other setting), use this command:
curl --request PUT \
--header "PRIVATE-TOKEN: <your_access_token>"
--url "https://gitlab.example.com/api/v4/application/settings?snippet_size_limit=52428800"
You can also use the API to retrieve the current value.
curl --header "PRIVATE-TOKEN: <your_access_token>" \
--url "https://gitlab.example.com/api/v4/application/settings"
Related topics
Docs
Edit this page to fix an error or add an improvement in a merge request.
Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.
Propose functionality by submitting a feature request.
Feature availability and product trials
View pricing to see all GitLab tiers and features, or to upgrade.
Try GitLab for free with access to all features for 30 days.
Get help
If you didn't find what you were looking for, search the docs.
If you want help with something specific and could use community support, post on the GitLab forum.
For problems setting up or using this feature (depending on your GitLab subscription).
Request support