What did you do before the bug happened? (Steps to reproduce your issue)
1. Create a bare hub repo.
mkdir hub
cd hub
git init --bare
cd ..
2. Create a bare mirror of the hub.
git clone --bare hub mirror
3. Create a working directory A and set its pushurls to hub and mirror.
git clone hub A
cd A
git remote set-url --add --push origin `dirname $PWD`/hub
git remote set-url --add --push origin `dirname $PWD`/mirror
4. Create commit 1 and push it to both.
echo a > a
git add .
git commit -m 'commit 1'
git push
5. Create a second working directory B without pushurls.
cd ..
git clone hub B
cd B
6. Create commit 2 in working directory B and push it to hub.
echo b > b
git add .
git commit -m 'commit 2'
git push
7. Create commit 3 in working directory A and try unsuccessfully to push it.
cd ../A
echo c > c
git add .
git commit -m 'commit 3'
git push
This throws an error when pushing to hub, but successfully pushes to mirror.
8. Try to fix the problem:
git pull --rebase
This completes successfully.
What did you expect to happen? (Expected behavior)
git log in working directory A should show all 3 commits
What happened instead? (Actual behavior)
git log shows commits 1 and 2 (created in B).
What's different between what you expected and what actually happened?
Commit 3 which was locally created is lost after the `git pull --rebase`.
Anything else you want to add:
I first encountered it in git 2.51.0. Also found to be present on HEAD of https://github.com/git/git
Problem exists independent of ~/.gitconfig.
[System Info]
git version:
git version 2.52.0.199.gbdc5341ff6
cpu: x86_64
built from commit: bdc5341ff65278a3cc80b2e8a02a2f02aa1fac06
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
rust: disabled
libcurl: 8.16.0
OpenSSL: OpenSSL 3.5.3 16 Sep 2025
zlib: 1.3.1
SHA-1: SHA1_DC
SHA-256: SHA256_BLK
default-ref-format: files
default-hash: sha1
uname: Linux 6.12.48-1-MANJARO #1 SMP PREEMPT_DYNAMIC Fri, 19 Sep 2025 16:11:04 +0000 x86_64
compiler info: gnuc: 15.2
libc info: glibc: 2.42
$SHELL (typically, interactive shell): /usr/bin/zsh
[Enabled Hooks]