2020-01-01 13:55:28 +05:30
---
type: reference, howto
2020-10-24 23:57:45 +05:30
stage: Create
group: Editor
2021-02-22 17:27:13 +05:30
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments"
2020-01-01 13:55:28 +05:30
---
2021-03-11 19:13:27 +05:30
# Snippets settings **(FREE SELF)**
2020-01-01 13:55:28 +05:30
Adjust the snippets' settings of your GitLab instance.
## Snippets content size limit
2020-06-23 00:09:42 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/31133) in GitLab 12.6.
2020-01-01 13:55:28 +05:30
2020-10-24 23:57:45 +05:30
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).
2020-01-01 13:55:28 +05:30
### How does it work?
2021-03-11 19:13:27 +05:30
The content size limit is applied when a snippet is created or updated.
2020-10-24 23:57:45 +05:30
2021-01-03 14:25:43 +05:30
This limit doesn't affect existing snippets until they're updated and their
content changes.
2020-01-01 13:55:28 +05:30
### Snippets size limit configuration
This setting is not available through the [Admin Area settings ](../../user/admin_area/settings/index.md ).
In order to configure this setting, use either the Rails console
or the [Application settings API ](../../api/settings.md ).
2021-02-22 17:27:13 +05:30
NOTE:
2020-10-24 23:57:45 +05:30
The value of the limit **must** be in bytes.
2020-01-01 13:55:28 +05:30
#### Through the Rails console
The steps to configure this setting through the Rails console are:
1. Start the Rails console:
2020-03-13 15:44:24 +05:30
```shell
2020-01-01 13:55:28 +05:30
# For Omnibus installations
sudo gitlab-rails console
# For installations from source
2020-04-08 14:13:33 +05:30
sudo -u git -H bundle exec rails console -e production
2020-01-01 13:55:28 +05:30
```
1. Update the snippets maximum file size:
```ruby
ApplicationSetting.first.update!(snippet_size_limit: 50.megabytes)
```
To retrieve the current value, start the Rails console and run:
```ruby
Gitlab::CurrentSettings.snippet_size_limit
```
#### Through the API
2021-03-11 19:13:27 +05:30
To set the snippets size limit through the Application Settings API (similar to
[updating any other setting ](../../api/settings.md#change-application-settings )), use this command:
2020-01-01 13:55:28 +05:30
2020-03-13 15:44:24 +05:30
```shell
2021-02-22 17:27:13 +05:30
curl --request PUT --header "PRIVATE-TOKEN: < your_access_token > " "https://gitlab.example.com/api/v4/application/settings?snippet_size_limit=52428800"
2020-01-01 13:55:28 +05:30
```
You can also use the API to [retrieve the current value ](../../api/settings.md#get-current-application-settings ).
2020-03-13 15:44:24 +05:30
```shell
2021-02-22 17:27:13 +05:30
curl --header "PRIVATE-TOKEN: < your_access_token > " "https://gitlab.example.com/api/v4/application/settings"
2020-01-01 13:55:28 +05:30
```