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
- Go
- Node.js & pnpm
Install Go from go.dev/dl
Clone the Repository
Building Gitea
Basic Build
Build Gitea with embedded assets: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:- Backend
- Frontend
Build only the Go backend:Requirements: Go 1.26.1+
Build Tags
Common build tags:| Tag | Description |
|---|---|
bindata | Embed static assets into binary |
sqlite | Enable SQLite database support |
sqlite_unlock_notify | Enable SQLite unlock notifications |
pam | Enable PAM authentication |
gogit | Use pure Go git implementation |
Development Build
For development with live 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
Build fails with 'cannot find package'
Build fails with 'cannot find package'
Run
make deps-backend to download Go dependencies:Frontend build fails
Frontend build fails
Ensure you’re using the correct Node.js and pnpm versions:
SQLite build fails
SQLite build fails
Install SQLite3 development headers:
Build is very slow
Build is very slow
- Use
make backendinstead 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