{"thread":{"id":"66755","subject":"[bug] push: bare --force-with-lease ignored on remote groups","startedAt":"2026-11-03T14:56:29Z","lastAt":"2026-11-04T00:39:29Z","messageCount":2,"participants":["Patrick Peroša","Tyler Cipriani"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"557323","messageId":"CAByu3etmpxF+zNqDQ0VJ5DZs_qxdnvQxxmeaMcGRGf36+8Oqww@mail.gmail.com","threadId":"66755","inReplyTo":null,"subject":"[bug] push: bare --force-with-lease ignored on remote groups","fromName":"Patrick Peroša","fromEmail":"pa3ck.perosa@gmail.com","sentAt":"2026-11-03T14:56:29Z","receivedAt":"2026-11-03T14:56:29Z","isPatch":false,"sender":{"key":"pa3ck.perosa@gmail.com","avatar":null},"body":"What did you do before the bug happened? (Steps to reproduce your issue)\n\nPushed a non-fast-forward update to a remote group using the bare\n--force-with-lease option (no <refname>[:<expect>] argument).\n\nMinimal reproduction with two file-based remotes grouped as \"both\":\n\n    git init --bare RemoteA.git\n    git init --bare RemoteB.git\n    git init -b main work && cd work\n    git remote add RemoteA ../RemoteA.git\n    git remote add RemoteB ../RemoteB.git\n    git config remotes.both \"RemoteA RemoteB\"\n    echo 1 >f && git add f && git commit -m one\n    echo 2 >>f && git commit -am two\n    git push RemoteA main && git push RemoteB main\n    git fetch --all\n    git reset --hard HEAD~1\n    echo 3 >>f && git commit -am three\n\n    GIT_TRACE=1 git push --force-with-lease --dry-run both main\n\nWhat did you expect to happen? (Expected behavior)\n\nThe --force-with-lease non fast forward push to happen to both remotes.\n     + d30bde7...c21af72 main -> main (forced update)\n\nThe same as would happen if the pushes were done individually\n\nWhat happened instead? (Actual behavior)\n\nBoth pushes are rejected as non-fast-forward and the command exits 1:\n\n     ! [rejected]        main -> main (non-fast-forward)\n\nWhat's different between what you expected and what actually happened?\n\nBoth pushes failed, seemingly not receiving the --force-with-lease flag\n\nAnything else you want to add:\n\nGIT_TRACE showed that a bare --force-with-lease does not forward the\nflag to the child processes that are spawned to execute the push on\neach remote.\n\n12:10:42.376196 git.c:506               trace: built-in: git push\n--force-with-lease --dry-run both main\n12:10:42.376772 run-command.c:673       trace: run_command: git push\n--dry-run RemoteA main\nPushing to RemoteA\n12:10:42.377701 run-command.c:765       trace: start_command:\n/root/git-builds/next/libexec/git-core/git push --dry-run RemoteA main\n12:10:42.380551 git.c:506               trace: built-in: git push\n--dry-run RemoteA main\n\nThe issue does not happen when an explicit <refname> is specified\n\n12:10:42.420633 git.c:506               trace: built-in: git push\n--force-with-lease=main --dry-run both main\n12:10:42.421239 run-command.c:673       trace: run_command: git push\n--dry-run --force-with-lease=main RemoteA main\nPushing to RemoteA\n12:10:42.421423 run-command.c:765       trace: start_command:\n/root/git-builds/next/libexec/git-core/git push --dry-run\n--force-with-lease=main RemoteA main\n\nThe issue also does not impact the normal --force flag\n\n12:10:42.437825 git.c:506               trace: built-in: git push\n--force --dry-run both main\n12:10:42.438310 run-command.c:673       trace: run_command: git push\n--force --dry-run RemoteA main\nPushing to RemoteA\n12:10:42.438508 run-command.c:765       trace: start_command:\n/root/git-builds/next/libexec/git-core/git push --force --dry-run\nRemoteA main\n12:10:42.439223 git.c:506               trace: built-in: git push\n--force --dry-run RemoteA main\n\nReproduced on:\n  - git 2.56.0.windows.4 (Git for Windows, where I first spotted the bug)\n  - git 2.56.0 (built from source on Linux/WSL2)\n  - git 2.56.0.341.gebdc087dc9 (master, built from source on Linux/WSL2)\n  - git 2.56.0.506.g506a7eabc5 (next, built from source on Linux/WSL2)\n\n--dry-run is used above only to make the reproduction repeatable; the\nsame rejection happens without it.\n\n[System Info]\ngit version:\ngit version 2.56.0.506.g506a7eabc5\ncpu: x86_64\nbuilt from commit: 506a7eabc523d0811286b66193419658da95cda5\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nrust: enabled\nfeature: fsmonitor--daemon\nlibcurl: 8.18.0\nOpenSSL: OpenSSL 3.5.5 27 Jan 2026\nzlib: 1.3.1\nSHA-1: SHA1_DC\nSHA-256: SHA256_BLK\ndefault-ref-storage-format: files\ndefault-hash: sha1\nuname: Linux 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC\nThu Jun  5 18:30:46 UTC 2025 x86_64\ncompiler info: gnuc: 15.2\nlibc info: glibc: 2.43\n$SHELL (typically, interactive shell): /bin/bash\n\n\n[Enabled Hooks]\n\n"},{"id":"557394","messageId":"aup-warMD9DDAgBs@localhost.localdomain","threadId":"66755","inReplyTo":"CAByu3etmpxF+zNqDQ0VJ5DZs_qxdnvQxxmeaMcGRGf36+8Oqww@mail.gmail.com","subject":"Re: [bug] push: bare --force-with-lease ignored on remote groups","fromName":"Tyler Cipriani","fromEmail":"tyler@tylercipriani.com","sentAt":"2026-11-04T00:39:29Z","receivedAt":"2026-11-04T00:39:29Z","isPatch":false,"sender":{"key":"tyler@tylercipriani.com","avatar":"https://gravatar.com/avatar/552e70f7d13c1043b4b97c2f80d1b6c4e7edcfe0f03dcce45bd6a1145c0529ec?d=mp&s=160"},"body":"On 26-11-03 15:56:29, Patrick Peroša wrote:\n\n>Both pushes are rejected as non-fast-forward and the command exits 1:\n<snip>\n\nI just pushed a fix for this one as a separate thread[0].\n\nSorry, meant to push it as a reply in this thread :(\n\n[0]: <https://lore.kernel.org/git/20261104002721.304153-1-tyler@tylercipriani.com/>\n\n"}]}