repo-local-git-hooks

仓库创建 2026年4月30日最近提交 22 天前SkillHot 收录 22 天前
▸ 精选理由

解决本地钩子被全局配置覆盖导致 CI/本地校验失效的常见痛点。

▸ 风险提示

会修改 Git 钩子或配置,需谨慎以免破坏开发环境设置。

这个 Skill 做什么

检测并修复因全局 core.hooksPath 绕过仓库本地 Git 钩子的问题。

检测并修复因全局 core.hooksPath 绕过仓库本地 Git 钩子导致的 lint/格式/测试失效,常见于 macOS 被 nix-darwin/home-manager 注入全局 hooks 的环境。适用于 .git/hooks 存在但被忽略、pre-commit 无法安装或 CI 放行本应拦截的提交时。提供审计脚本并能恢复为优先使用本地钩子的状态。

▸ 展开 SKILL.md 英文原文

Detect and repair cases where repository-local Git hooks are bypassed by a global core.hooksPath, especially on macOS machines managed by nix-darwin/home-manager that inject global gitleaks/git-hooks paths. Use when CI catches lint/format/test issues that pre-commit or pre-push should have caught, when .git/hooks exists but Git ignores it, when installing pre-commit refuses because core.hooksPath is set, or when a repo needs local pre-commit/pre-push hooks to override global hooks.

开发编程git钩子修复CI通用
0
Stars
0
Forks
16
仓库内 Skill
+0
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/Eotel/skills/main/repo-local-git-hooks/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/Eotel/skills/main/repo-local-git-hooks/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# Repo Local Git Hooks

Use this skill when a repo expects local hooks but Git is using a global `core.hooksPath`. The common symptom is: `.git/hooks/pre-commit` exists, yet commits/pushes run only a global Nix/gitleaks hook or no repo-specific lint at all.

## Audit First

Run the bundled audit script from the target repo:

```bash
path/to/repo-local-git-hooks/scripts/audit_git_hooks.sh
```

Or inspect manually:

```bash
git config --show-origin --get-all core.hooksPath || true
git rev-parse --git-common-dir
git rev-parse --git-path hooks
```

Interpretation:

- `git rev-parse --git-path hooks` must match `$(git rev-parse --git-common-dir)/hooks` when repo-local `.git/hooks` should be effec
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有