Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue. What did you do before the bug happened? (Steps to reproduce your issue) Clone a repository and run this command: git fetch origin main:main What did you expect to happen? (Expected behavior) Nothing extraordinary happens. The branch is up to date. What happened instead? (Actual behavior) fatal: refusing to fetch into branch 'refs/heads/main' checked out at '' fatal: the remote end hung up unexpectedly remote: remote: ======================================================================== remote: remote: rpc error: code = Canceled desc = running upload-pack: user canceled the request remote: remote: ======================================================================== remote: Anything else you want to add: If I checkout to another branch and run the same `git fetch` command on this branch, the same error happens. Further, if change HEAD but keep the same branch name, like this: git checkout HEAD^ git checkout -B main ... then `git fetch origin main:main` fails as well. Please review the rest of the bug report below. You can delete any lines you don't wish to share. [System Info] git version: git version 2.45.0 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 6.8.9-arch1-2 #1 SMP PREEMPT_DYNAMIC Tue, 07 May 2024 21:35:54 +0000 x86_64 compiler info: gnuc: 13.2 libc info: glibc: 2.39 $SHELL (typically, interactive shell): /bin/sh [Enabled Hooks] not run from a git repository - no hooks to show