# Git 与部署流 ## 固定仓库 - Windows/WSL SSH:`ssh://git@git.txyundm.cn:2222/panda/qipai.git` - 生产同机只读 SSH:`ssh://git@127.0.0.1:2222/panda/qipai.git` - 默认分支:`main` ## 本地推送 1. 在 `D:\qipai` 完成一个模块子阶段。 2. 运行 Windows 检查脚本。 3. 提交本模块相关文件。 4. 执行 `git push origin main`。 5. 执行 `git fetch origin main` 并校验 `HEAD == origin/main`。 推荐使用: ```powershell powershell -ExecutionPolicy Bypass -File scripts/dev/windows/push-module.ps1 ` -Message "chore(M00-C): 完善模块推送脚本" ` -Paths @("scripts/dev/windows/push-module.ps1", "docs/git-deployment.md") ``` 如出现 `Host key verification failed`,先通过可信渠道确认 `git.txyundm.cn:2222` 的 SSH 主机指纹,再更新 `known_hosts`。Codex 不自动覆盖主机信任记录。 ## SSH 检查 ```powershell powershell -ExecutionPolicy Bypass -File scripts/dev/windows/check-gitea-ssh.ps1 ``` 该脚本只检查已有 known_hosts 与 SSH 握手,不自动写入新主机指纹。 ## 当前记录 - 2026-06-15 首次 `origin/main` push 已成功,且 `HEAD == origin/main` 校验通过。 - 如后续再次出现 `Host key verification failed`,仍应先通过可信渠道确认主机指纹,不自动追加或覆盖 known_hosts。 ## 生产发布 生产服务器不得因 Gitea push 自动发布。管理员必须在 Ubuntu 上通过 `/opt/apps/setup.sh` 菜单拉取、构建、迁移和复检。 ## 域名与证书 - Nginx 模板位于 `deploy/nginx/api.txyundm.cn.conf.template`。 - Certbot 管理员命令说明位于 `deploy/certbot/api.txyundm.cn.commands.md`。 - `setup.sh --https` 仅检查域名、Nginx、TLS、健康端点和 Certbot 状态,不自动申请证书或 reload Nginx。