1

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?

John Bergqvist
  • 852
  • 13
  • 38
  • Can you check the names of the branches on the remote ? the local view you have : `git branch -r`, and also what git sees when it contacts the remote server : `git ls-remote origin` – LeGEC Jan 26 '22 at 15:01
  • also : what is your shell ? it is possible that this `?` is actually a replacement character for something else – LeGEC Jan 26 '22 at 15:10
  • @LeGEC I'm using `GNU bash, version 4.4.23(1)-release (x86_64-pc-msys)`, with `git version 2.34.1.windows.1`. The branch names in `git branch -r` and `git ls-remote origin` don't have `?` at the end, i.e. `origin/custom-branch` and `refs/heads/custom-branch` – John Bergqvist Jan 26 '22 at 15:49
  • This indicates that something is goofed up in the 2.34.1 Git-for-Windows; try upgrading to 2.35.0, perhaps. That seems odd—this is the kind of thing that would be caught by Git's own CI system—but perhaps it only affect some particular Windows version(s). – torek Jan 27 '22 at 07:59

0 Answers0