「Gitea」- 基于 Git 的代码托管服务 | 自建 | Git-based

认识

官网:https://about.gitea.com/
文档:https://docs.gitea.com/
仓库:https://github.com/go-gitea/gitea/

Gitea is a community fork of the popular self-hosted Git service Gogs. We’re a growing group of former Gogs users and contributors who found the single-maintainer management model of Gogs frustrating and thus decided to make an effort to build a more open and faster development model. 简而言之,Gitea 类似于 GitLab 是个开源的 DevOps 平台,基于 Git 进行代码托管。

组成

配置文件 app.ini

/path/to/gitea/conf/app.ini

Configuration Cheat Sheet | https://docs.gitea.com/administration/config-cheat-sheet

构建

v1.23.8 | on Kubernetes | with Helm Chart

How to change SSh git clone url?
https://docs.gitea.com/installation/install-on-kubernetes

Giteat v1.23.8, Kubernetes v1.30.0-tke.9, Helm Chart version 12.0.0

我们使用自建的 MySQL 数据库,针对 Giteat v1.23.8 版本,我们使用 MySQL 8.0.37 版本。原因在于,

  • 我们 PostgreSQL 经验较少,其官方 Chart 不处理数据库服务升级。
  • 复用已有 MySQL 数据库实例,降低资源消耗。

数据库初始化操作 | Database Preparation / MySQL | https://docs.gitea.com/installation/database-prep

CREATE USER 'gitea'@'%' IDENTIFIED BY 'WOJsfAYKFHOXSW0';
CREATE DATABASE gitea CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin';
GRANT ALL PRIVILEGES ON gitea.* TO 'gitea';
FLUSH PRIVILEGES;

执行 Gitea Helm Chart 安装:

helm repo add gitea-charts https://dl.gitea.com/charts/
helm repo update gitea-charts

helm pull gitea-charts/gitea
helm show values ./gitea-12.0.0.tgz > gitea-12.0.0.tgz.helm-values.yaml

vim gitea-12.0.0.tgz.helm-values.yaml

... global.storageClass:
... persistence.storageClass:

... gitea.admin.username:
... gitea.admin.password:

... valkey-cluster.enabled: false
... valkey.enabled: true

... postgresql-ha.enabled: false
... postgresql.enabled: false

... gitea.config.database:           # https://gitea.com/gitea/helm-gitea#external-database

... gitea.config.server.SSH_DOMAIN:  # 修改 SSH 域名

... ingress:

用户管理

默认管理账户:

接入 Light LDAP lldap 认证:

提高 LDAP 同步频率,使用户尽快生效 | https://forum.gitea.com/t/trigger-synchronize-external-user-data-programmatically/3466

...
gitea:
  ...
  config:
    ...
    cron.sync_external_users:
      ENABLED: true
      RUN_AT_START: false
      NOTICE_ON_SUCCESS: false
      SCHEDULE: "@every 1m"
      UPDATE_EXISTING: true
    ...
  ...
...

性质

  • Code Hosting
  • Code Review
  • CI/CD
  • Project Management
  • Artifact Repository

  • Multilingual Support

  • Lightweight and Fast
  • Easy Deployment and Maintenance
  • Security
  • Open Source Community Support

API Usage and

https://docs.gitea.com/next/development/api-usage

认证方法:

  • HTTP basic authentication
  • token=… parameter in URL query string
  • access_token=… parameter in URL query string
  • Authorization: token … header in HTTP headers

SDK | https://gitea.com/gitea/awesome-gitea#sdk

参考

从 Gogs vs Gitea 看中外文化差异 | Wolfogre’s Blog
go-gitea/gitea: Git with a cup of tea, painless self-hosted git service
Welcome to Gitea – Blog
What is Gitea?