You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Read a Bare Push's Destination From Branch Config, Not a Remote-Tracking Ref, in the Write Guard #3019
Found by the local review of the change closing #2973. Develop's guard shares both shapes. Each was confirmed against git 2.47.3 in throwaway repositories, with git push --dry-run --porcelain showing what a bare push writes.
A Bare Push's Branch Is Read From the Remote-Tracking Ref, Not the Remote Branch
_current_push_branch reads @{push}, which names the remote-tracking ref a push updates, and derives the remote branch from that ref's name. Two shapes make the two differ:
A fetch refspec that maps into a sub-path of the remote's own namespace, such as +refs/heads/*:refs/remotes/origin/mirror/*. With push.default=upstream and branch.feature/example.merge=refs/heads/develop, @{push} is refs/remotes/origin/mirror/develop. The guard reads mirror/develop and allows, while git writes develop.
No remote-tracking ref for the destination, such as a --single-branch clone of another branch, or one never fetched. With push.default=upstream and the merge ref refs/heads/develop, @{push} fails with "not stored as a remote-tracking branch". The read then falls back to --abbrev-ref HEAD, reads feature/example, and allows, while git writes develop.
Possible Direction
Read the destination from the branch's own configuration rather than from a remote-tracking ref name. branch.<name>.merge names the upstream branch for push.default=upstream, and the current name is the destination for current. Where push.default cannot be read, read both, and fail closed where neither resolves.
Activity
Read Completed, Pruned, and Slash-Remote Push Targets in the Write Gu…
ptr727 commentedon Oct 15, 2026
Claimed for an engineering-track lane (handoff #3040 resume). Branch:
feature/guard-bare-push-target-3019. Predicted file set:host-setup/agent-safety/claude/gh-write-guard.py,host-setup/agent-safety/claude/test_install.py,host-setup/agent-safety/README.md,host-setup/agent-safety/claude/README.md.Read a Bare Push's Destination From Branch Config, a Persisted Mirror…