Files
sxbh.ltd/github-advanced.html
T
Hermes CI FixandHermes AI e1a9b25afa init: sxbh.ltd 官网初始提交
- nginx 安全加固 (CSP, HSTS, 缓存策略)
- 共享 style.css
- 138个页面全部接入

Co-authored-by: Hermes AI <agent@hermes>
2026-07-11 17:29:24 +08:00

381 lines
18 KiB
HTML
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.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GitHub 从入门到实战:结合 Hermes 多 Agent 架构的精进之路</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #f5f6f7; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; padding: 30px 0; }
.container { max-width: 800px; margin: 0 auto; }
.header {
background: linear-gradient(135deg, #1b1f23 0%, #24292e 50%, #2b3137 100%);
color: #fff; padding: 48px 40px 36px; border-radius: 12px 12px 0 0;
position: relative; overflow: hidden;
}
.header::after {
content: '🐙'; position: absolute; right: 30px; top: 20px; font-size: 52px; opacity: 0.1;
}
.header .badge {
display: inline-block; background: rgba(255,255,255,0.1);
padding: 4px 14px; border-radius: 20px; font-size: 12px; letter-spacing: 1px; margin-bottom: 14px;
}
.header h1 { font-size: 26px; line-height: 1.35; margin-bottom: 8px; }
.header .sub { font-size: 14px; opacity: 0.7; line-height: 1.6; }
.header .meta { font-size: 12px; opacity: 0.5; margin-top: 10px; }
.content { background: #fff; padding: 40px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.section { margin-bottom: 28px; }
.section-title {
font-size: 19px; color: #1b1f23; font-weight: 700;
border-left: 4px solid #24292e; padding-left: 14px; margin-bottom: 12px;
}
.section-lead {
background: #f6f8fa; border: 1px solid #e1e4e8; border-radius: 6px;
padding: 14px 18px; margin-bottom: 16px; font-size: 14px; color: #444; line-height: 1.7;
}
p { font-size: 14px; line-height: 1.8; color: #333; margin-bottom: 10px; }
p strong { color: #1b1f23; }
table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0 14px; }
table th { background: #24292e; color: #fff; padding: 8px 12px; text-align: left; font-weight: 500; }
table th:first-child { border-radius: 4px 0 0 0; }
table th:last-child { border-radius: 0 4px 0 0; }
table td { padding: 8px 12px; border-bottom: 1px solid #e1e4e8; }
table tr:nth-child(even) { background: #f6f8fa; }
.code-block {
background: #1e2a35; color: #e6edf3; border-radius: 6px;
padding: 14px 18px; margin: 10px 0; font-family: "Courier New", monospace;
font-size: 12px; line-height: 1.7; overflow-x: auto;
}
.code-block .hl { color: #ffa657; }
.code-block .gr { color: #7ee787; }
.code-block .bl { color: #58a6ff; }
.code-block .cm { color: #8b949e; }
.tip-box {
background: #f0f6ff; border: 1px solid #c8e1ff; border-radius: 6px;
padding: 14px 16px; margin: 10px 0; font-size: 13px; line-height: 1.7; color: #1a4d8c;
}
.tip-box strong { color: #0d47a1; }
.warn-box {
background: #fff8e1; border: 1px solid #ffe082; border-radius: 6px;
padding: 14px 16px; margin: 10px 0; font-size: 13px; line-height: 1.7; color: #6d4c00;
}
.warn-box strong { color: #e65100; }
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.card {
background: #f6f8fa; border: 1px solid #e1e4e8; border-radius: 6px; padding: 14px;
}
.card .title { font-size: 14px; font-weight: 600; color: #1b1f23; margin-bottom: 4px; }
.card .desc { font-size: 12px; color: #666; line-height: 1.5; }
.separator { text-align: center; color: #d0d7de; font-size: 13px; margin: 22px 0; letter-spacing: 5px; }
.footer {
background: #24292e; color: rgba(255,255,255,0.5);
padding: 20px 40px; border-radius: 0 0 12px 12px; font-size: 12px; text-align: center; line-height: 1.6;
}
ul { padding-left: 18px; margin: 8px 0; }
ul li { font-size: 13px; line-height: 1.7; color: #444; margin-bottom: 4px; }
@media (max-width: 640px) {
.content { padding: 20px; }
.header { padding: 30px 20px; }
.header h1 { font-size: 20px; }
.card-grid { grid-template-columns: 1fr; }
}
</style>
<link rel="stylesheet" href="/style.css">
</head>
<body>
<div class="container">
<div class="header">
<div class="badge">🐙 GitHub × Hermes 实战</div>
<h1>GitHub 从入门到实战</h1>
<div class="sub">注册 · 认证 · 建仓库 · 搜索 · 协作 · 部署<br>结合多 Agent 架构的精进之路</div>
<div class="meta">基于 QuantumAI 入门教程 · 研学补充 Hermes 实战经验</div>
</div>
<div class="content">
<!-- 开篇 -->
<div class="section">
<div class="section-lead">
<strong>本文适合两类读者:</strong><br>
🐣 零基础新手:从注册到第一个 PR,每一步都有截图级说明<br>
🦾 进阶开发者:结合你正在运行的 Hermes Agent(⭐203K)实战场景,涵盖多 Profile 管理、CI/CD、安全审计
</div>
<p>GitHub 目前汇聚了全球超过 2 亿开发者,托管超 6 亿个开源仓库。腾讯、阿里、字节等几乎所有国内大厂的开源项目都托管在此。当下最热的 AI Agent 框架——<strong>obra/superpowers(⭐238K)、Hermes Agent(⭐203K)、OpenClaw(⭐380K</strong>——全部在 GitHub 上开源。</p>
<p>本文分上下两篇:上篇覆盖注册到基础操作(给新手),下篇结合你实际的 Hermes 多 Agent 架构讲进阶实战(给老手)。</p>
</div>
<div class="separator">━ 上篇 · 入门基础 ━</div>
<!-- 一、核心概念 -->
<div class="section">
<div class="section-title">一、先搞懂核心概念</div>
<p><strong>闭源 vs 开源:</strong>代码仅保存在本地电脑叫闭源;上传至 GitHub 公开仓库叫开源。开源 ≠ 放弃版权,通过 LICENSE 文件界定使用权限。</p>
<p><strong>Git vs GitHub</strong></p>
<table>
<tr><th></th><th>Git</th><th>GitHub</th></tr>
<tr><td>本质</td><td>本地版本控制工具</td><td>云端代码托管平台</td></tr>
<tr><td>安装</td><td>需装在自己电脑上</td><td>Web 服务,浏览器访问</td></tr>
<tr><td>核心功能</td><td>记录每次修改,支持回退任意版本</td><td>托管 Git 仓库,云端备份,多人协作</td></tr>
<tr><td>类比</td><td>本地写日记</td><td>把日记本发到云端共享</td></tr>
</table>
</div>
<!-- 二、注册与认证 -->
<div class="section">
<div class="section-title">二、注册与 2FA 认证</div>
<p><strong>注册流程:</strong>访问 <code>github.com</code> → 点击 Sign up → 填写邮箱、密码、用户名、地区 → 邮箱验证。</p>
<div class="tip-box">
<strong>💡 避坑建议:</strong><br>
· 邮箱优先 Gmail——后续 Supabase、Vercel、Cloudflare 等工具均支持谷歌账号一键登录<br>
· 用户名是你的永久身份标识,建议用固定英文 ID 或姓名拼音<br>
· 密码用浏览器生成高强度随机密码并保存,不要手动设置
</div>
<p><strong>2FA 双重认证(必做):</strong>GitHub 2023 年起强制要求:有代码贡献行为的账号必须在 90 天内开通。</p>
<p>开通路径:Settings → Password and authentication → Two-factor authentication → Enable → 选择 Authenticator App → 扫码绑定 Google Authenticator → <strong>保存 16 组恢复码</strong>(手机丢失时唯一找回途径)。</p>
<div class="warn-box">
<strong>⚠️ 血的教训:</strong>恢复码不备份 = 账号不设防。建议同时存密码管理器 + 打印纸质版。我们团队曾有人因换手机没备份恢复码,花了 3 天才联系 GitHub 客服找回账号。
</div>
</div>
<!-- 三、建仓库 -->
<div class="section">
<div class="section-title">三、新建仓库与搜索</div>
<p><strong>新建仓库:</strong>右上角「+」→ New repository → 填写仓库名(小写英文+连字符)→ 填描述 → 选 Public/Private → <strong>务必勾选 Add a README file</strong> → Create repository。</p>
<p><strong>精准搜索技巧:</strong></p>
<div class="code-block">
<span class="cm"># 按星数筛选</span>
<span class="bl">stars:>1000</span> <span class="gr">AI agent</span>
<span class="cm"># 按编程语言</span>
<span class="bl">language:</span>python <span class="gr">agent framework</span>
<span class="cm"># 按主题标签</span>
<span class="bl">topic:</span>ai-agents <span class="gr">enterprise</span>
<span class="cm"># 组合使用(查找高星 AI Agent 项目)</span>
<span class="bl">stars:>5000 language:python topic:</span>ai-agents
</div>
<p>搜索后左侧可筛分类(Repositories / Code / Issues),右上角可排序(Most stars / Recently updated)。</p>
</div>
<div class="separator">━ 下篇 · Hermes 进阶实战 ━</div>
<!-- 四、Hermes 实战 -->
<div class="section">
<div class="section-title">四、多 Profile 仓库管理策略</div>
<p>你手上有 8 个 Hermes Profile,每个 profile 都有独立的 skills/、scripts/、config.yaml。如果各自为政,版本管理很快就会失控。推荐的分支策略:</p>
<div class="code-block">
<span class="cm"># 仓库结构建议</span>
hermes-config/
├── <span class="hl">profiles/</span>
│ ├── wecom-project/ <span class="cm"># 项目BOT 配置</span>
│ ├── wecom-employees/ <span class="cm"># 员工BOT 配置</span>
│ ├── wecom-finance/ <span class="cm"># 财务BOT 配置</span>
│ ├── wecom-ops/ <span class="cm"># 运维BOT 配置</span>
│ ├── wecom-admin/ <span class="cm"># 管理BOT 配置</span>
│ ├── wecom-business/ <span class="cm"># 业务BOT 配置</span>
│ ├── wecom-creative/ <span class="cm"># 创意BOT 配置</span>
│ └── wecom-yanxue/ <span class="cm"># 研学BOT 配置</span>
├── <span class="hl">shared/</span>
│ ├── skills/ <span class="cm"># 跨Profile 共享技能</span>
│ └── scripts/ <span class="cm"># 通用脚本</span>
├── <span class="hl">.github/</span>
│ └── workflows/ <span class="cm"># CI/CD 流水线</span>
├── README.md
└── <span class="gr"> registry.json</span> <span class="cm"># 控制面注册表</span>
</div>
<table>
<tr><th>分支</th><th>用途</th><th>谁合并</th></tr>
<tr><td><code>main</code></td><td>生产就绪配置,只接受 PR</td><td>管理员</td></tr>
<tr><td><code>dev</code></td><td>日常开发集成分支</td><td>各 Profile 负责人</td></tr>
<tr><td><code>feat/xxx</code></td><td>新 skill 或脚本开发</td><td>开发者自建</td></tr>
<tr><td><code>hotfix/xxx</code></td><td>紧急修复</td><td>运维BOT 触发</td></tr>
</table>
<div class="tip-box">
<strong>💡 实操建议:</strong><br>
先建一个私有仓库 <code>hermes-config</code>,把 8 个 Profile 的配置统一管起来。每个 Profile 的敏感信息(API Key、Token)用 <code>.env</code> 文件管理,不提交到 Git。
</div>
</div>
<!-- 五、Git Workflow -->
<div class="section">
<div class="section-title">五、日常 Git 工作流</div>
<div class="code-block">
<span class="cm"># 克隆仓库</span>
git clone https://github.com/your-org/hermes-config.git
cd hermes-config
<span class="cm"># 创建功能分支</span>
git checkout -b feat/add-security-scan
<span class="cm"># 修改文件后查看状态</span>
git status
git diff
<span class="cm"># 提交到本地</span>
git add .
git commit -m "feat: 添加安全扫描脚本,检测硬编码密钥"
<span class="cm"># 推送远程并创建 PR</span>
git push origin feat/add-security-scan
</div>
<p>提交信息规范推荐使用 <strong>Conventional Commits</strong></p>
<table>
<tr><th>类型</th><th>场景</th><th>示例</th></tr>
<tr><td><code>feat</code></td><td>新功能</td><td><code>feat: 添加 Loop Engineering 编排器</code></td></tr>
<tr><td><code>fix</code></td><td>修复</td><td><code>fix: 修复 builder 权限检查越界</code></td></tr>
<tr><td><code>docs</code></td><td>文档</td><td><code>docs: 更新 HERMES 架构图</code></td></tr>
<tr><td><code>chore</code></td><td>杂项</td><td><code>chore: 升级依赖版本</code></td></tr>
<tr><td><code>security</code></td><td>安全修复</td><td><code>security: 移除硬编码 API Key</code></td></tr>
</table>
</div>
<!-- 六、CI/CD -->
<div class="section">
<div class="section-title">六、用 GitHub Actions 自动检查</div>
<p>GitHub Actions 是内置的 CI/CD 工具,可以在每次 Push 或 PR 时自动跑检查。以下是一个检查 Skill 安全性的 Workflow</p>
<div class="code-block">
<span class="cm"># .github/workflows/security-scan.yml</span>
<span class="bl">name:</span> Security Scan
<span class="bl">on:</span>
<span class="bl">push:</span>
<span class="bl">paths:</span>
- <span class="gr">'profiles/**/skills/**'</span>
- <span class="gr">'shared/scripts/**'</span>
<span class="bl">jobs:</span>
<span class="bl">scan:</span>
<span class="bl">runs-on:</span> ubuntu-latest
<span class="bl">steps:</span>
- <span class="bl">uses:</span> actions/checkout@v4
- <span class="bl">name:</span> 检测硬编码密钥
<span class="bl">run:</span> |
grep -rn "API_KEY\|SECRET\|TOKEN\|password" \
--include="*.py" --include="*.sh" --include="*.json" \
--exclude="*.env" . || true
- <span class="bl">name:</span> 检查可疑网络请求
<span class="bl">run:</span> |
grep -rn "curl\|wget\|requests.post" \
--include="*.py" --include="*.sh" . | grep -v "localhost\|127.0.0.1" || true
</div>
<div class="tip-box">
<strong>💡 这和你的安全门计划是同一件事:</strong><br>
Phase 2 要做的手动扫描脚本,可以直接写成 GitHub Action,每次你 Push 新 skill 时就自动跑一遍安全扫描。扫描不通过的 PR 无法合并。
</div>
</div>
<!-- 七、Fork & PR -->
<div class="section">
<div class="section-title">七、Fork、Star、Issue、PR 实战</div>
<table>
<tr><th>操作</th><th>含义</th><th>什么时候用</th></tr>
<tr><td><strong>Star ⭐</strong></td><td>收藏项目,表示关注</td><td>看到好项目先 Star,方便以后找</td></tr>
<tr><td><strong>Fork 🍴</strong></td><td>复制别人仓库到你名下</td><td>你想基于别人的项目做二次开发</td></tr>
<tr><td><strong>Issue 📋</strong></td><td>提交问题或建议</td><td>报告 Bug、提新功能需求</td></tr>
<tr><td><strong>PR 📥</strong></td><td>请求合并你的代码</td><td>你修改了 Fork 的仓库,希望原作者采纳</td></tr>
<tr><td><strong>Watch 👁️</strong></td><td>关注项目动态</td><td>接收项目的 Release、Issue 通知</td></tr>
</table>
<div class="warn-box">
<strong>⚠️ 给 Hermes 用户的特别提醒:</strong><br>
Hermes AgentNousResearch/hermes-agent)当前 ⭐203K,是 GitHub 上增长最快的 AI Agent 项目之一。如果你对它做二次开发,<strong>Fork 后记得定期同步上游更新</strong><br>
<code>git remote add upstream https://github.com/NousResearch/hermes-agent.git</code><br>
<code>git fetch upstream && git merge upstream/main</code>
</div>
</div>
<!-- 八、安全红线 -->
<div class="section">
<div class="section-title">八、安全红线:绝不要把密钥传上 GitHub</div>
<p>GitHub 上有爬虫在持续扫描公开仓库中的密钥。一旦你把 API Key 或 Token 误提交到公开仓库,几分钟内就会被抓取并滥用。</p>
<div class="card-grid">
<div class="card">
<div class="title">✅ 正确做法</div>
<div class="desc">· .env 文件管理密钥,加入 .gitignore<br>· 用 GitHub Secrets 存敏感信息<br>· 用 git-secrets 或 pre-commit 钩子防误提交</div>
</div>
<div class="card">
<div class="title">❌ 错误做法</div>
<div class="desc">· 在代码里硬编码 API Key<br>· 把 .env 提交到 Git<br>· 在公开仓库里放密码文件</div>
</div>
</div>
<div class="code-block">
<span class="cm"># .gitignore 必备内容</span>
<span class="gr">.env</span>
<span class="gr">*.key</span>
<span class="gr">*.pem</span>
<span class="gr">__pycache__/</span>
<span class="gr">node_modules/</span>
<span class="gr">.hermes/</span>
<span class="gr">*.log</span>
</div>
<div class="tip-box">
<strong>💡 补救措施:</strong>如果不小心把密钥提交了,<strong>立即在 GitHub 上删除并轮换密钥</strong>(不只是删文件——要从 Git 历史里清除)。用 <code>git filter-branch</code><code>bfg-repo-cleaner</code>
</div>
</div>
<!-- 结语 -->
<div class="section">
<div class="section-title">总结:你的 GitHub 能力清单</div>
<table>
<tr><th>能力</th><th>新手目标</th><th>进阶目标(你的水平)</th></tr>
<tr><td>注册与 2FA</td><td>完成注册+绑定 Authenticator</td><td>✅ 已完成,已管 8 个 Profile</td></tr>
<tr><td>建仓库</td><td>建第一个公开仓库</td><td>建 hermes-config 私有仓库,统一 8 个 Profile</td></tr>
<tr><td>搜索项目</td><td>能找高 Star 项目</td><td>能追踪 Hermes/superpowers 上游更新</td></tr>
<tr><td>Git 工作流</td><td>git add/commit/push</td><td>分支策略 + Conventional Commits + PR Review</td></tr>
<tr><td>CI/CD</td><td>了解 Actions</td><td>配置安全扫描 Action + 自动部署</td></tr>
<tr><td>安全</td><td>知道 .gitignore</td><td>git-secrets + pre-commit 钩子 + 密钥轮换</td></tr>
<tr><td>开源协作</td><td>Star / Fork</td><td>向 Hermes 上游提 PR / Issue</td></tr>
</table>
</div>
</div>
<div class="footer">
基于 QuantumAI《一文超详细讲透GitHub》· 研学补充 Hermes 实战经验<br>
NousResearch/hermes-agent ⭐203K · obra/superpowers ⭐238K · OpenClaw ⭐380K
</div>
</div>
</body>
</html>