Skip to content

Read Push Config a Command Rewrites Before the Push in the Write Guard #3046

Closed

Description

@ptr727

Context

Found by the local review of the change closing #3019, #3020, #3029, and #3036. Develop's guard shares it, since develop reads neither setting.

A Command Before the Push Can Rewrite the Config the Guard Reads

The guard reads a push's persisted config from the checkout as it stands before the command runs. A command earlier in the same Bash call can change that config first.

  • git config remote.origin.mirror true && git push --tags origin reads the mirror key as unset, so the push is read as tags only, while git runs it as a mirror push that prunes every branch.
  • git remote set-url origin https://example.invalid/example/other.git && git push origin develop is judged against the rules of the origin read before the command, while git writes to the other repository.

A bare push in either shape is already unresolved, since git config and git remote mark the branch read unreliable. The gap is a push with no refspec beyond the bare form, and a push with an explicit refspec.

Possible Direction

Where a git config or git remote command runs before a push in the same command, read the push's mirror setting and its checkout's origin as unresolved. A checkout or switch before the push changes neither, so it should not take part.

Activity

  1. added
    bug
    pre-existing
    script
    on Oct 15, 2026
  2. added a commit that references this issue on Oct 21, 2026
    fb7f02b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpre-existingscript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions