Snippets settings (CORE ONLY)
Adjust the snippets' settings of your GitLab instance.
Snippets content size limit
Introduced in GitLab 12.6.
You can set a maximum content size limit for snippets. This limit can prevent abuse of the feature. The default value is 52428800 Bytes (50 MB).
How does it work?
The content size limit will be applied when a snippet is created or updated.
In order not to break any existing snippets, the limit doesn't have any effect on them until a snippet is edited again and the content changes.
Snippets size limit configuration
NOTE: IMPORTANT: The value of the limit must be in bytes.
Through the Rails console
The steps to configure this setting through the Rails console are:
Start the Rails console:
# For Omnibus installations sudo gitlab-rails console # For installations from source sudo -u git -H bundle exec rails console -e production
Update the snippets maximum file size:
To retrieve the current value, start the Rails console and run:
Through the API
The process to set the snippets size limit through the Application Settings API is exactly the same as you would do to update any other setting.
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" 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>" https://gitlab.example.com/api/v4/application/settings