gitea

Development moved to Codeberg


date: "2016-12-26T16:00:00+02:00" title: "Config Cheat Sheet" slug: "config-cheat-sheet" weight: 20 toc: false draft: false menu: sidebar: parent: "advanced" name: "Config Cheat Sheet" weight: 20

identifier: "config-cheat-sheet"

Configuration Cheat Sheet

This is a cheat sheet for the Gitea configuration file. It contains most of the settings that can be configured as well as their default values.

Any changes to the Gitea configuration file should be made in custom/conf/app.ini or any corresponding location. When installing from a distribution, this will typically be found at /etc/gitea/conf/app.ini.

The defaults provided here are best-effort (not built automatically). They are accurately recorded in app.example.ini (s/main/<tag|release>). Any string in the format %(X)s is a feature powered by ini, for reading values recursively.

Values containing # or ; must be quoted using ` or """.

Note: A full restart is required for Gitea configuration changes to take effect.

{{< toc >}}

Overall (DEFAULT)

Repository (repository)

Repository - Editor (repository.editor)

Repository - Pull Request (repository.pull-request)

Repository - Issue (repository.issue)

Repository - Upload (repository.upload)

Repository - Release (repository.release)

Repository - Signing (repository.signing)

Repository - Local (repository.local)

Repository - MIME type mapping (repository.mimetype_mapping)

Configuration for set the expected MIME type based on file extensions of downloadable files. Configuration presents in key-value pairs and file extensions starts with leading ..

The following configuration set Content-Type: application/vnd.android.package-archive header when downloading files with .apk file extension.

.apk=application/vnd.android.package-archive

CORS (cors)

UI (ui)

UI - Admin (ui.admin)

UI - Metadata (ui.meta)

UI - Notification (ui.notification)

UI - SVG Images (ui.svg)

UI - CSV Files (ui.csv)

Markdown (markdown)

Server (server)

Database (database)

Please see #8540 & #8273 for further discussion of the appropriate values for MAX_OPEN_CONNS, MAX_IDLE_CONNS & CONN_MAX_LIFETIME and their relation to port exhaustion.

Indexer (indexer)

Queue (queue and queue.*)

Configuration at [queue] will set defaults for queues with overrides for individual queues at [queue.*]. (However see below.)

Gitea creates the following non-unique queues:

And the following unique queues:

Certain queues have defaults that override the defaults set in [queue] (this occurs mostly to support older configuration):

Admin (admin)

Security (security)

OpenID (openid)

OAuth2 Client (oauth2_client)

Service (service)

Service - Explore (service.explore)

SSH Minimum Key Sizes (ssh.minimum_key_sizes)

Define allowed algorithms and their minimum key length (use -1 to disable a type):

Webhook (webhook)

Mailer (mailer)

Cache (cache)

Cache - LastCommitCache settings (cache.last_commit)

Session (session)

Picture (picture)

Project (project)

Default templates for project boards:

Issue and pull request attachments (attachment)

Log (log)

Router Log (log)

Access Log (log)

Log subsections (log.name, log.name.*)

Console log mode (log.console, log.console.*, or MODE=console)

File log mode (log.file, log.file.* or MODE=file)

Conn log mode (log.conn, log.conn.* or MODE=conn)

SMTP log mode (log.smtp, log.smtp.* or MODE=smtp)

Cron (cron)

Basic cron tasks - enabled by default

Cron - Cleanup old repository archives (cron.archive_cleanup)

Cron - Update Mirrors (cron.update_mirrors)

Cron - Repository Health Check (cron.repo_health_check)

Cron - Repository Statistics Check (cron.check_repo_stats)

Cron - Cleanup hook_task Table (cron.cleanup_hook_task_table)

Cron - Update Migration Poster ID (cron.update_migration_poster_id)

Cron - Sync External Users (cron.sync_external_users)

Extended cron tasks (not enabled by default)

Cron - Garbage collect all repositories ('cron.git_gc_repos')

Cron - Update the '.ssh/authorized_keys' file with Gitea SSH keys ('cron.resync_all_sshkeys')

Cron - Resynchronize pre-receive, update and post-receive hooks of all repositories ('cron.resync_all_hooks')

Cron - Reinitialize all missing Git repositories for which records exist ('cron.reinit_missing_repos')

Cron - Delete all repositories missing their Git files ('cron.delete_missing_repos')

Cron - Delete generated repository avatars ('cron.delete_generated_repository_avatars')

Cron - Delete all old actions from database ('cron.delete_old_actions')

Cron - Check for new Gitea versions ('cron.update_checker')

Git (git)

Git - Timeout settings (git.timeout)

Metrics (metrics)

API (api)

OAuth2 (oauth2)

i18n (i18n)

U2F (U2F) DEPRECATED

Markup (markup)

Gitea can support Markup using external tools. The example below will add a markup named asciidoc.

[markup.asciidoc]
ENABLED = true
NEED_POSTPROCESS = true
FILE_EXTENSIONS = .adoc,.asciidoc
RENDER_COMMAND = "asciidoc --out-file=- -"
IS_INPUT_FILE = false

Two special environment variables are passed to the render command: - GITEA_PREFIX_SRC, which contains the current URL prefix in the src path tree. To be used as prefix for links. - GITEA_PREFIX_RAW, which contains the current URL prefix in the raw path tree. To be used as prefix for image paths.

If DISABLE_SANITIZER is false, Gitea supports customizing the sanitization policy for rendered HTML. The example below will support KaTeX output from pandoc.

[markup.sanitizer.TeX]
; Pandoc renders TeX segments as <span>s with the "math" class, optionally
; with "inline" or "display" classes depending on context.
ELEMENT = span
ALLOW_ATTR = class
REGEXP = ^\s*((math(\s+|$)|inline(\s+|$)|display(\s+|$)))+
ALLOW_DATA_URI_IMAGES = true

Multiple sanitisation rules can be defined by adding unique subsections, e.g. [markup.sanitizer.TeX-2]. To apply a sanitisation rules only for a specify external renderer they must use the renderer name, e.g. [markup.sanitizer.asciidoc.rule-1]. If the rule is defined above the renderer ini section or the name does not match a renderer it is applied to every renderer.

Highlight Mappings (highlight.mapping)

Time (time)

Task (task)

Task queue configuration has been moved to queue.task. However, the below configuration values are kept for backwards compatibility:

Migrations (migrations)

Federation (federation)

Mirror (mirror)

LFS (lfs)

Storage configuration for lfs data. It will be derived from default [storage] or [storage.xxx] when set STORAGE_TYPE to xxx. When derived, the default of PATH is data/lfs and the default of MINIO_BASE_PATH is lfs/.

Storage (storage)

Default storage configuration for attachments, lfs, avatars and etc.

And you can also define a customize storage like below:

[storage.my_minio]
STORAGE_TYPE = minio
; Minio endpoint to connect only available when STORAGE_TYPE is `minio`
MINIO_ENDPOINT = localhost:9000
; Minio accessKeyID to connect only available when STORAGE_TYPE is `minio`
MINIO_ACCESS_KEY_ID =
; Minio secretAccessKey to connect only available when STORAGE_TYPE is `minio`
MINIO_SECRET_ACCESS_KEY =
; Minio bucket to store the attachments only available when STORAGE_TYPE is `minio`
MINIO_BUCKET = gitea
; Minio location to create bucket only available when STORAGE_TYPE is `minio`
MINIO_LOCATION = us-east-1
; Minio enabled ssl only available when STORAGE_TYPE is `minio`
MINIO_USE_SSL = false

And used by [attachment], [lfs] and etc. as STORAGE_TYPE.

Repository Archive Storage (storage.repo-archive)

Configuration for repository archive storage. It will inherit from default [storage] or [storage.xxx] when set STORAGE_TYPE to xxx. The default of PATH is data/repo-archive and the default of MINIO_BASE_PATH is repo-archive/.

Proxy (proxy)

i.e.

PROXY_ENABLED = true
PROXY_URL = socks://127.0.0.1:1080
PROXY_HOSTS = *.github.com

Other (other)