On 2026-11-22 a research subagent ran git push from a linked worktree (.claude/worktrees/agent-<id>, branch research/copilot-cli-agents). The pre-push hooks ran and the push failed (see the worktree-gate issue). Afterwards the main checkout's.git/config had core.bare = true:
git rev-parse --is-inside-work-tree returned false in /root/ai-development
git worktree list showed the main checkout as (bare)
the next push from the main checkout failed inside pre-commit with fatal: this operation must be run in a work tree
git config core.bare false restored it, and a later push from the main checkout left it false. The subagent also reported that its first push attempt left the worktree's HEAD detached at an older main commit.
Likely cause
This is the same class of bug that tests/run-tests.sh lines 36–42 already guard against. Git exports GIT_DIR (and possibly GIT_WORK_TREE, GIT_INDEX_FILE, GIT_COMMON_DIR) to hooks, so a fixture's git -C "$tmp" … resolves to this repo; the validate-provenance-skill.batscommit_as_base helper once flipped core.bare that way. run-tests.sh unsets them, but some other pre-push hook path does not. From a linked worktree, GIT_DIR points at .git/worktrees/<id>, and writes to config land in the shared .git/config.
To do
Reproduce: push from a linked worktree under .claude/worktrees/ and check git config core.bare on the main checkout afterwards.
Find the hook entry point that doesn't clear the inherited GIT_* variables (candidates: hooks that call bats or build fixture repos outside run-tests.sh, and apm-audit-ci's install replay), and unset them there, or centrally.
Add a regression test that runs the hook set with GIT_DIR exported and asserts core.bare is unchanged.
## What happened
On 2026-11-22 a research subagent ran `git push` from a linked worktree (`.claude/worktrees/agent-<id>`, branch `research/copilot-cli-agents`). The pre-push hooks ran and the push failed (see the worktree-gate issue). Afterwards the **main checkout's** `.git/config` had `core.bare = true`:
- `git rev-parse --is-inside-work-tree` returned `false` in `/root/ai-development`
- `git worktree list` showed the main checkout as `(bare)`
- the next push from the main checkout failed inside pre-commit with `fatal: this operation must be run in a work tree`
`git config core.bare false` restored it, and a later push from the main checkout left it `false`. The subagent also reported that its first push attempt left the worktree's HEAD detached at an older `main` commit.
## Likely cause
This is the same class of bug that `tests/run-tests.sh` lines 36–42 already guard against. Git exports `GIT_DIR` (and possibly `GIT_WORK_TREE`, `GIT_INDEX_FILE`, `GIT_COMMON_DIR`) to hooks, so a fixture's `git -C "$tmp" …` resolves to this repo; the `validate-provenance-skill.bats` `commit_as_base` helper once flipped `core.bare` that way. `run-tests.sh` unsets them, but some other pre-push hook path does not. From a linked worktree, `GIT_DIR` points at `.git/worktrees/<id>`, and writes to `config` land in the shared `.git/config`.
## To do
- Reproduce: push from a linked worktree under `.claude/worktrees/` and check `git config core.bare` on the main checkout afterwards.
- Find the hook entry point that doesn't clear the inherited `GIT_*` variables (candidates: hooks that call bats or build fixture repos outside `run-tests.sh`, and `apm-audit-ci`'s install replay), and unset them there, or centrally.
- Add a regression test that runs the hook set with `GIT_DIR` exported and asserts `core.bare` is unchanged.
Found while working [Copilot CLI agent behaviour from docs](https://git.rkdr.net/Mortis/Holocron/issues/187).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What happened
On 2026-11-22 a research subagent ran
git pushfrom a linked worktree (.claude/worktrees/agent-<id>, branchresearch/copilot-cli-agents). The pre-push hooks ran and the push failed (see the worktree-gate issue). Afterwards the main checkout's.git/confighadcore.bare = true:git rev-parse --is-inside-work-treereturnedfalsein/root/ai-developmentgit worktree listshowed the main checkout as(bare)fatal: this operation must be run in a work treegit config core.bare falserestored it, and a later push from the main checkout left itfalse. The subagent also reported that its first push attempt left the worktree's HEAD detached at an oldermaincommit.Likely cause
This is the same class of bug that
tests/run-tests.shlines 36–42 already guard against. Git exportsGIT_DIR(and possiblyGIT_WORK_TREE,GIT_INDEX_FILE,GIT_COMMON_DIR) to hooks, so a fixture'sgit -C "$tmp" …resolves to this repo; thevalidate-provenance-skill.batscommit_as_basehelper once flippedcore.barethat way.run-tests.shunsets them, but some other pre-push hook path does not. From a linked worktree,GIT_DIRpoints at.git/worktrees/<id>, and writes toconfigland in the shared.git/config.To do
.claude/worktrees/and checkgit config core.bareon the main checkout afterwards.GIT_*variables (candidates: hooks that call bats or build fixture repos outsiderun-tests.sh, andapm-audit-ci's install replay), and unset them there, or centrally.GIT_DIRexported and assertscore.bareis unchanged.Found while working Copilot CLI agent behaviour from docs.