newsreport_agent_for_traffic/GITEA_SYNC_GUIDE.md

2.1 KiB

Gitea 同步准备清单

本文件用于在同步到公司 Gitea 前,明确哪些工作已经完成,哪些仍需人工确认。

已完成

  • 已新增 .env.example
  • 已强化 .gitignore
  • 已排除以下不应提交的内容:
    • .env
    • data/
    • vector_db/
    • 临时探针目录
    • 日志和错误文件
    • 本地 IDE 目录

推送前必须人工确认

1. 旋转敏感凭据

当前本地 .env 中包含真实敏感信息。即使 .env 已被忽略,也建议在同步公司仓库前完成以下动作:

  • 更换 Qwen API Key
  • 更换邮箱 SMTP 授权码
  • 更新微信公众号后台 Cookie

原因:

  • 这些凭据已经在本地仓库和运行环境中出现过
  • 后续团队协作中不应继续使用当前这组值

2. 检查 Git 历史

如果这些敏感文件曾经被提交过,即使当前 .gitignore 排除了它们,也仍可能留在 Git 历史里。

请确认:

git log --stat
git status

如果发现 .envdata/vector_db/ 曾被提交,需要额外做历史清理。

3. 确认不提交的大文件和临时目录

建议不要提交:

  • data/
  • vector_db/
  • vector_db_backup_*
  • tmp_*
  • rebuild_vector_db.log
  • rebuild_vector_db.err

建议提交的目录和文件

  • crawler/
  • rag/
  • report/
  • static/
  • templates/
  • main.py
  • generate_report_from_db.py
  • email_web_app.py
  • email_sender.py
  • rebuild_vector_db.py
  • requirements.txt
  • .gitignore
  • .env.example
  • README.md
  • 各类使用文档

首次推送到 Gitea 的建议步骤

1. 检查当前状态

git status

2. 首次提交

git add .
git commit -m "Initial import"

3. 绑定 Gitea 远程仓库

git remote add origin <你的-gitea-仓库地址>

4. 推送

git branch -M main
git push -u origin main

推荐在 Gitea 仓库首页说明的事项

  • 需要本地配置 .env
  • 公众号抓取依赖 WECHAT_MP_COOKIE
  • 默认不提交运行产物和向量库
  • 默认报告时间窗口为最近 15 天
  • 综合报告按来源均衡取样