Skip to content

fix(kustomize-validate): scrub hook GIT_DIR so worktree pushes validate#20

Merged
cshuttle merged 1 commit into
mainfrom
fix/kustomize-validate-worktree
Jul 17, 2026
Merged

fix(kustomize-validate): scrub hook GIT_DIR so worktree pushes validate#20
cshuttle merged 1 commit into
mainfrom
fix/kustomize-validate-worktree

Conversation

@cshuttle

Copy link
Copy Markdown
Owner

Git hooks export an absolute GIT_DIR (always, for worktrees) that leaks into kustomize's nested git during remote-resource clones — git remote add origin hits the outer repo: "remote origin already exists". Every pre-push from a git worktree of a GitOps repo failed on remote-git-base overlays while the identical tree passed standalone and in CI.

Fix: unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_COMMON_DIR GIT_PREFIX at script top. Verified: the reproduction (hook-style GIT_DIR from a cshuttle/main worktree, intel-gpu-plugin overlays) fails on the old script and builds 2/2 on this one. shellcheck clean.

🤖 Generated with Claude Code

Git hooks export an absolute GIT_DIR (always for worktrees) that leaks
into kustomize's nested git when it clones remote resources — its
`git remote add origin` targets the OUTER repo and dies with "remote
origin already exists". Repro: pre-push from any git worktree of
cshuttle/main failed on the intel-gpu-plugin overlays (the only remote
git bases); the same tree validated clean when run standalone and in
CI. unset the hook env at script top; verified the exact repro now
builds 2/2 under a hook-style GIT_DIR.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cshuttle
cshuttle merged commit d402c04 into main Jul 17, 2026
7 checks passed
@cshuttle
cshuttle deleted the fix/kustomize-validate-worktree branch July 17, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant