I'm working on some CI automation involving pushing to a git branch, using git on Windows (Git 2.34.1).
My problem is whenever I push to my upstream branch, and the push fails because since starting my CI job, that branch has been updated by something else, and so I need to rebase.
I run git pull --rebase -Xtheirs
, yet the pull command fails, and I see lots of these errors, for every branch in the repository (i've just included a couple here, because we have hundreds of branches):
error: cannot lock ref 'refs/remotes/origin/custom-branch/test?': Unable to create 'C:/r/w/cover/CF/SpringProject/.git/refs/remotes/origin/custom-branch/test?.lock': Invalid argument
error: could not remove reference refs/remotes/origin/custom-branch/test?
error: cannot lock ref 'refs/remotes/origin/custom-branch?': Unable to create 'C:/r/w/cover/CF/SpringProject/.git/refs/remotes/origin/custom-branch?.lock': Invalid argument
error: could not remove reference refs/remotes/origin/custom-branch?
To me, it looks like it's trying to create a branchname?.lock
file for every branch, yet because ?
is an invalid character in Windows, it's unable to do this and thus doesn't get anywhere.
Have people seen anything this before? I've upgraded from Windows Server 2019 to Windows Server 2022, but I don't see how that could make any difference to this?