🦊

Gitea 宝石

开发工具

轻量级自托管 Git 服务,具有类似 GitHub 的界面

部署信息

部署: 2-5分钟
类别: 开发工具
最小内存: 512MB
支持: 入票和电子邮件

共享此指南

概览

Gitea is a lightweight, self-hosted Git service written in Go that provides a painless setup and minimal resource requirements. It's the perfect alternative to GitHub, GitLab, or Bitbucket when you want full control over your code repositories without the heavy resource footprint. Gitea can run on a Raspberry Pi and uses minimal RAM (less than 100MB), making it ideal for small teams, personal projects, or environments with limited resources. Despite its lightweight nature, Gitea packs powerful features including repositories, pull requests, code review, issue tracking, wikis, organizations, webhooks, and built-in CI/CD with Gitea Actions (GitHub Actions compatible). The single binary deployment means no complex dependencies - just download, configure, and run.

密钥特征

Lightweight & Fast

Single binary, minimal RAM (<100MB), runs on Raspberry Pi

GitHub-like Interface

Familiar UI with repos, pull requests, issues, wikis, and code review

Gitea Actions

Built-in CI/CD compatible with GitHub Actions workflows

Easy Migration

Import from GitHub, GitLab, Bitbucket with built-in migration tools

Multi-Database Support

SQLite, PostgreSQL, MySQL, MSSQL, TiDB support

Docker & Kubernetes Ready

Official images and Helm charts for container deployments

使用案例

• Personal Git hosting on home servers or VPS
• Small team code repositories with minimal infrastructure
• Internal company Git service with full control
• Educational environments teaching Git workflows
• Migration from GitHub/GitLab to self-hosted solution
• CI/CD with Gitea Actions for automated testing/deployment

《安装指南》

Quick Install (Binary):
# Download latest binary
wget -O gitea https://dl.gitea.com/gitea/1.21/gitea-1.21-linux-amd64
chmod +x gitea

# Run
./gitea web
# Access at http://localhost:3000
Docker Installation:
docker run -d --name=gitea -p 3000:3000 -p 222:22 \
  -v /var/lib/gitea:/data gitea/gitea:latest
Production with PostgreSQL:
# Install PostgreSQL
sudo apt install postgresql

# Create DB & user
sudo -u postgres psql
CREATE DATABASE gitea;
CREATE USER gitea WITH PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE gitea TO gitea;

# Create gitea user
sudo adduser --system --group --disabled-password --shell /bin/bash --home /home/git git

# Download & install
sudo wget -O /usr/local/bin/gitea https://dl.gitea.com/gitea/1.21/gitea-1.21-linux-amd64
sudo chmod +x /usr/local/bin/gitea

# Create directories
sudo mkdir -p /var/lib/gitea/{custom,data,log}
sudo chown -R git:git /var/lib/gitea
sudo chmod -R 750 /var/lib/gitea

# Systemd service
sudo nano /etc/systemd/system/gitea.service
# [Service]
# User=git
# WorkingDirectory=/var/lib/gitea
# ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
# Restart=always

sudo systemctl enable --now gitea

配置提示

app.ini Configuration:
[server]
DOMAIN = git.yourdomain.com
HTTP_PORT = 3000
ROOT_URL = https://git.yourdomain.com/

[database]
DB_TYPE = postgres
HOST = localhost:5432
NAME = gitea
USER = gitea
PASSWD = password

[security]
INSTALL_LOCK = true
SECRET_KEY = generate_with_gitea_generate_secret

[service]
DISABLE_REGISTRATION = true
REQUIRE_SIGNIN_VIEW = false
Gitea Actions (.gitea/workflows/build.yml):
name: Build
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '18'
      - run: npm install && npm test

技术要求

系统要求

  • 记忆: 512MB 内存(MM)

请为这篇文章评分

★★★★★
-
正在装入...

准备好部署您的应用程序了吗? Gitea 宝石?

几分钟后开始 我们简单的VPS部署程序

大约2分钟后部署 • 全部根访问 • 支持 以票和电子邮件方式