A new 'governed git' system routes repo pushes through a session-scoped mount, with safety checks around it
What
Claude Code adds a subsystem called 'governed git' that routes a repository's push traffic through a 'git mount' - a relay that uses a session-scoped credential instead of a raw token. This affects self-hosted runners and cloud sessions:
- The push URL for a governed-git repo is rewritten to go through the mount, and this rewrite is kept in sync ('reconciled') live as the session's token changes, including on every token refresh.
- Rewriting is restricted to repositories hosted on
github.com; for any other host the existing push path is left alone and a notice is logged instead. - Before routing a fetch through the mount, the runner checks the local git version against a required minimum; if git is too old, or the runner is running with
--capacitygreater than 1 (which means git config is shared across multiple sessions), mount routing is skipped and a warning is logged rather than failing silently. - Governed-git session config can now also carry a push base URL and a list of "direct upstreams" (repos allowed to bypass the mount and use their plain upstream URL); if this list isn't supplied, or the git mount URL shape doesn't allow it, every source is reset to its normal upstream URL after setup, with a warning.
- New telemetry (
self_hosted_governed_push_url/represent_failedandself_hosted_governed_mount_read/represent_failed) fires when a session's token can't be re-presented to the remote service, warning that git traffic through the mount may be refused (git_token_mismatch) until it succeeds. - When a session ends, any branch whose source repo is only reachable through the mount is no longer pushed as part of cleanup - that push is skipped with an explanatory warning instead of failing or going to the wrong URL.
Why
This lets Claude Code enforce credential scoping and access policy on git pushes for governed repositories without changing how users interact with git, while adding fallbacks so that older git versions, shared-config runners, non-GitHub hosts, or mismatched tokens degrade to a safe, explicit warning rather than a silent failure or a push to the wrong place.