# ERR-20260512-001: git config key 不允许下划线，set -e 下 pre-push hook 整体 abort

## 症状

`git push` 失败：
```
pre-push: 跑本地 AI Review 自检（可 FFOA_SKIP_AI_REVIEW_LOCAL=1 跳过）
ℹ️  无改动可审（分支累计改动 vs origin/develop 为空）
error: invalid key: push.ai_check_sha
error: failed to push some refs to 'ssh://...'
```

## 根因

`.githooks/pre-push` 用 `git config --local push.ai_check_sha "$HEAD"` 缓存上次 AI 自检的 SHA，但 git config 的 variable name 只允许 **字母数字 + 短横线 `-`**，下划线 `_` 会被拒绝（git 输出 `error: invalid key`）。

钩子开头有 `set -euo pipefail`，所以 `git config` 返回 1 直接让整个 hook abort，push 被拒。

## 修复

`.githooks/pre-push` 中 4 处 `push.ai_check_sha` 全部改为 camelCase 的 `push.aiCheckSha`。

```bash
sed -i 's/push\.ai_check_sha/push.aiCheckSha/g' .githooks/pre-push
```

## 验证

`git config --local push.aiCheckSha test` 不报错；重新 push 通过。

## 教训

- git config key 命名规则：`[a-zA-Z0-9-]`，下划线非法。Section/subsection 之间用点；同一段内单词用 camelCase 是 git 自己的惯例（`user.email` / `core.autoCRLF`）
- pre-push hook 用 `set -e` 时，任何 `git config` 设置失败都会让整个 push 阻断。给 helper config 操作加 `|| true` 是更稳的写法，但根治还是命名合规
- 这种 bug 的隐蔽性：本地测过的开发者 config 里可能本来就有这个 key（旧版 git 没那么严？或者从未触发设置路径），代码 review 时容易漏

## 类似坑

任何 `git config <section>.<subsection>.<name>` 里都不能用下划线。例如 `branch.master.mergeOptions` 合法，`branch.master.merge_options` 非法。
