正式なドキュメントは英語版であり、この日本語訳はAI支援翻訳により作成された参考用のものです。日本語訳の一部の内容は人間によるレビューがまだ行われていないため、翻訳のタイミングにより英語版との間に差異が生じることがあります。最新かつ正確な情報については、英語版をご参照ください。

Snippets

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab Self-Managed

To prevent abuse of snippets on your instance, configure a maximum snippet size that is enforced when users create or update snippets. Existing snippets are not affected by the limit unless a user updates them, and their content changes.

The default limit is 52428800 bytes (50 MB).

Configure the snippet size limit

To configure the snippet size limit, use either 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:

  1. Start the Rails console.

  2. 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"

To retrieve the current value from the API:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/application/settings"