# Default Settings for Gitea: Complete Configuration Reference

> Explore Gitea's default settings and configuration. Understand how app.ini overrides built-in values and master your Gitea setup for optimal performance and control.

- Repository: [Gitea/gitea](https://github.com/go-gitea/gitea)
- Tags: api-reference
- Published: 2026-03-07

---

**Gitea's default settings are hard-coded in the `modules/setting` package and applied at startup, with values from [`app.ini`](https://github.com/go-gitea/gitea/blob/main/app.ini) overriding the built-in struct defaults defined in [`repository.go`](https://github.com/go-gitea/gitea/blob/main/repository.go), [`server.go`](https://github.com/go-gitea/gitea/blob/main/server.go), and [`service.go`](https://github.com/go-gitea/gitea/blob/main/service.go).**

When you deploy Gitea without a custom configuration file, the application initializes using predefined constants compiled into the binary. Understanding these default settings for Gitea is essential for secure deployment planning, as values like open user registration and permissive proxy settings may require immediate adjustment before production use.

## Default Repository Settings

Repository behavior defaults are defined in [`modules/setting/repository.go`](https://github.com/go-gitea/gitea/blob/main/modules/setting/repository.go). These settings control branch naming, visibility rules, and file upload constraints.

### Branch and Visibility Defaults

The **default branch** for new repositories is set to `"main"` as defined at line 176 in [`repository.go`](https://github.com/go-gitea/gitea/blob/main/repository.go).

- **DefaultPrivate** (`repository.go#L58`): Defaults to `RepoCreatingLastUserVisibility`, which creates a **private** repository if the creator's last repository visibility was private.
- **ForcePrivate** (`repository.go#L30`): Defaults to `false`, allowing users to choose repository visibility rather than forcing all repositories to be private.

### File Upload Limits

The upload configuration struct in [`repository.go`](https://github.com/go-gitea/gitea/blob/main/repository.go) controls attachment handling for releases and issues:

- **Upload.Enabled**: `true` (`repository.go#L94`)
- **Upload.FileMaxSize**: `50` MB (`repository.go#L96`)
- **Upload.MaxFiles**: `5` (`repository.go#L97`)

## Default Server Configuration

Server network settings are declared in [`modules/setting/server.go`](https://github.com/go-gitea/gitea/blob/main/modules/setting/server.go). These determine how the Gitea instance binds to network interfaces.

- **Domain**: `"localhost"` (`server.go#L88`)
- **HTTPAddr**: `"0.0.0.0"` (`server.go#L89`)
- **HTTPPort**: `"3000"` (`server.go#L90`)
- **EnableAcme**: `false` (lines 94-99), meaning Let's Encrypt SSL certificates are disabled by default

## Default Service and Security Settings

Service-level defaults in [`modules/setting/service.go`](https://github.com/go-gitea/gitea/blob/main/modules/setting/service.go) and security templates control authentication behavior and installation access.

### User Registration and Authentication

- **DisableRegistration**: `false` (`service.go#L54`), meaning **anyone can sign up** for an account
- **RequireSignInView**: `false` (`service.go#L55`), making the home page and public repositories visible without authentication
- **EnableBasicAuth**: `true` (`service.go#L182`)
- **EnablePasswordSignInForm**: `true` (`service.go#L183`)

### Installation Security

The bundled [`app.ini`](https://github.com/go-gitea/gitea/blob/main/app.ini) template in [`docker/rootless/etc/templates/app.ini`](https://github.com/go-gitea/gitea/blob/main/docker/rootless/etc/templates/app.ini) defines critical security defaults:

- **INSTALL_LOCK**: `false`, leaving the initial installation wizard accessible
- **REVERSE_PROXY_TRUSTED_PROXIES**: `*`, trusting all proxy headers by default

## How Gitea Loads Default Settings

Gitea uses a structured initialization process defined in [`modules/setting/setting.go`](https://github.com/go-gitea/gitea/blob/main/modules/setting/setting.go). The **configuration loading sequence** follows this architecture:

1. **Struct Definition**: Configuration groups (Repository, Server, Service) are defined as exported structs in `modules/setting/*.go` with hard-coded default values assigned to fields.

2. **INI Parsing**: The application uses `github.com/go-ini/ini` wrapped by a `ConfigProvider` interface to parse [`app.ini`](https://github.com/go-gitea/gitea/blob/main/app.ini).

3. **Load Sequence**: The `setting.Init()` function calls specialized loaders like `loadServerFrom`, `loadRepositoryFrom`, and `loadServiceFrom`. Each function reads its corresponding INI section and overwrites struct fields only if the key exists in the configuration file.

4. **Runtime Access**: After initialization, the populated structs are accessible as exported package variables (`setting.Repository`, `setting.Server`, `setting.Service`) that handlers and services import directly.

If [`app.ini`](https://github.com/go-gitea/gitea/blob/main/app.ini) is missing or specific keys are undefined, the structs retain their hard-coded default values from the source code.

## Overriding Default Settings in Practice

You can inspect and override these defaults through Go code or configuration files.

### Accessing Defaults Programmatically

To read the current default branch setting from within the Gitea codebase:

```go
package main

import (
	"fmt"
	"code.gitea.io/gitea/modules/setting"
)

func main() {
	fmt.Printf("Default branch: %s\n", setting.Repository.DefaultBranch)
}

```

Running without configuration overrides outputs:

```

Default branch: main

```

### Customizing via app.ini

Create [`custom/app.ini`](https://github.com/go-gitea/gitea/blob/main/custom/app.ini) to override specific values:

```ini
[repository]
DEFAULT_BRANCH = develop

[server]
HTTP_PORT = 8080

```

Start Gitea with the custom configuration:

```bash
./gitea web -c custom/app.ini

```

The application now uses `develop` as the default branch and listens on port **8080**.

### Using Settings in Handlers

Access configuration values in HTTP handlers via the exported structs:

```go
func healthHandler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "Running on %s:%s\n", setting.Server.Domain, setting.Server.HTTPPort)
}

```

## Summary

- **Default branch** is `"main"`, defined in [`modules/setting/repository.go`](https://github.com/go-gitea/gitea/blob/main/modules/setting/repository.go) at line 176
- **Server binds** to `0.0.0.0:3000` with domain `localhost` as specified in [`modules/setting/server.go`](https://github.com/go-gitea/gitea/blob/main/modules/setting/server.go)
- **User registration** is enabled by default (`DisableRegistration = false`), allowing public sign-ups
- **Installation lock** is disabled by default, exposing the setup wizard on first run
- **Configuration loading** occurs through `setting.Init()`, which calls `load*From` functions to merge [`app.ini`](https://github.com/go-gitea/gitea/blob/main/app.ini) values with hard-coded struct defaults
- **Runtime access** to settings uses exported package variables like `setting.Repository` and `setting.Server`

## Frequently Asked Questions

### What is the default branch name in Gitea?

The default branch is **`"main"`**, as hard-coded in [`modules/setting/repository.go`](https://github.com/go-gitea/gitea/blob/main/modules/setting/repository.go) at line 176. You can override this by setting `DEFAULT_BRANCH` in the `[repository]` section of [`app.ini`](https://github.com/go-gitea/gitea/blob/main/app.ini).

### What port does Gitea use by default?

Gitea listens on **port 3000** by default (`HTTPPort = "3000"` in [`modules/setting/server.go`](https://github.com/go-gitea/gitea/blob/main/modules/setting/server.go) line 90). The server binds to all interfaces (`0.0.0.0`) with domain `localhost`. Change this via the `HTTP_PORT` key in the `[server]` section of your configuration file.

### Is user registration enabled by default in Gitea?

Yes, **user registration is enabled by default** (`DisableRegistration = false` in [`modules/setting/service.go`](https://github.com/go-gitea/gitea/blob/main/modules/setting/service.go) line 54). This allows anyone to create accounts. For private instances, set `DISABLE_REGISTRATION = true` in the `[service]` section of [`app.ini`](https://github.com/go-gitea/gitea/blob/main/app.ini) immediately after installation.

### Where are Gitea's default configuration values defined?

Default values are **hard-coded in the Go source files** within `modules/setting/`. Key files include [`repository.go`](https://github.com/go-gitea/gitea/blob/main/repository.go) for Git settings, [`server.go`](https://github.com/go-gitea/gitea/blob/main/server.go) for network configuration, and [`service.go`](https://github.com/go-gitea/gitea/blob/main/service.go) for authentication policies. The `setting.Init()` function in [`setting.go`](https://github.com/go-gitea/gitea/blob/main/setting.go) orchestrates loading these defaults and merging them with [`app.ini`](https://github.com/go-gitea/gitea/blob/main/app.ini) overrides at runtime.