Windows container fails to clone gitlab repository

I am running a gitlab CI pipeline with the following .yml file:

image: buildtools2019

stages:
  - build

build-job:
  stage: build
  script:
    - echo "Starting to build the project"
    - mkdir build && cd build
    - cmake -G "Visual Studio 16 2019" -DOTS_DIRECTORY:PATH="C:\OTS" ..
    - cmake --build . --config Release
    - ctest -V -D Experimental -C Release --output-junit "xml:report.xml"
  artifacts:
    when: always
    reports:
      junit: report.xml
    paths:
      - build/

The pipeline fails before even checking out the repository. This is the output that I get:

Getting source from Git repository
Fetching changes...
Initialized empty Git repository in C:/builds/project-0/.git/
Created fresh repository.
error: cannot lock ref 'refs/remotes/origin/feature/build_system': unable to resolve reference 'refs/remotes/origin/feature/build_system': Not a directory
error: cannot lock ref 'refs/remotes/origin/feature/plugin_backend': unable to resolve reference 'refs/remotes/origin/feature/plugin_backend': Not a directory
error: cannot lock ref 'refs/remotes/origin/main': unable to resolve reference 'refs/remotes/origin/main': Not a directory
ERROR: Job failed: exit code 1

The three branches that we see are local branches, in the repository where I’m starting the CI build. The runner is using a local docker image (for testing purposes).
Any ideas what’s up with this error? I can’t find any hints for this.

Thanks

I don’t have a personal experience but it looks like you have a known issue (multiple reports on the internet) and I guess you have found some of them like: