Skip to main content

Prerequisites

Before building Gitea, ensure you have the following installed:

Required

  • Go: Version 1.26.1 or later (as specified in go.mod)
  • Node.js: Version 22.6.0 or later
  • pnpm: Version 10.0.0 or later
  • Git: For cloning the repository
  • Make: Build automation

Optional

  • Docker: For building Docker images
  • SQLite3: If building with SQLite support

Installation

Install Go from go.dev/dl

Clone the Repository

Building Gitea

Basic Build

Build Gitea with embedded assets:
This creates a gitea binary in the root directory.

Build with SQLite Support

To include SQLite database support:
SQLite support requires CGO to be enabled and SQLite3 development headers installed.

Build Targets

The build process is split into two main targets:
Build only the Go backend:
Requirements: Go 1.26.1+

Build Tags

Common build tags: Example with multiple tags:

Development Build

For development with live reloading:
Or use Air for automatic reloading:

Building for Production

Optimized Build

Cross-Compilation

Build for different platforms:

Building Docker Images

Standard Docker Image

Rootless Docker Image

Makefile Targets

Common make targets:

Configuration

Development Configuration

Create a custom configuration for development:

Running the Development Build

Troubleshooting

Run make deps-backend to download Go dependencies:
Ensure you’re using the correct Node.js and pnpm versions:
Install SQLite3 development headers:
  • Use make backend instead of full build during development
  • Enable build cache: GOCACHE=$(go env GOCACHE)
  • Use faster linker: go build -ldflags='-s -w'

See Also

Contributing

Learn how to contribute to Gitea

Testing

Run tests and write new tests

Architecture

Understand Gitea’s codebase structure

Installation

Install pre-built Gitea binaries