Files
nexus/wiki/concepts/Local-first-Git.md
2026-04-22 19:20:32 +08:00

36 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Local-first Git"
type: concept
tags: [git, security, devops, self-hosted, devsecops]
date: 2026-04-22
---
## Definition
Local-first Git 是一种 Git 工作流策略:所有代码变更首先推送到本地/私有 Git 服务(而非直接推送到公共 GitHub经过 CI 扫描和人工 review 后再合并到公共仓库。核心原则:**公共仓库永远不应该是 Agent 的直接目标**。
## In Home Lab Context
在 [[self-healing-home-server]] 的安全架构中Local-first Git 工作流:
```
Agent commits
Gitea (private self-hosted) — 私有中转站
CI pipeline — TruffleHog secrets scanning
Human review — 必须人工审核 main 分支合并
GitHub (public) — 最终发布目标
```
## Why Local-first for AI Agents?
1. **Secrets 暴露风险**AI Agent 会在代码中直接写入 API keysTruffleHog 可检测但不能阻止)
2. **CI 安全扫描**:在代码到达公共仓库前,有机会拦截问题
3. **Human oversight**:人工 review 作为最后防线
4. **Audit trail**Gitea 提供完整的代码变更审计记录
## Connections
- [[Gitea]] — Local-first 工作流的核心基础设施
- [[TruffleHog]] — CI pipeline 中的 secrets scanning 工具
- [[Defense-in-Depth]] — Local-first Git 是多层安全防御的一环
- [[OpenClaw]] — 使用 Local-first Git 工作流的 Agent 平台