install_git_hooks.sh 409 B

123456789
  1. #!/usr/bin/env bash
  2. # 安装仓库级 git hooks:将 core.hooksPath 指向 .githooks/,启用提交前知识库校验。
  3. # 幂等,可重复执行。
  4. set -euo pipefail
  5. ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
  6. git -C "$ROOT" config core.hooksPath .githooks
  7. echo "hooksPath -> $(git -C "$ROOT" config core.hooksPath)"
  8. echo "已启用: $ROOT/.githooks/pre-commit (知识库提交前校验)"