Hi there! I've got what I think is a bug in recent versions of git, at least as packaged for macOS by homebrew. I'm cloning a fresh copy of a repository into a bare directory: $ mkdir tmp $ cd tmp $ git init --bare $ git remote add origin -- <VALID-URL>.git $ git fetch -f origin 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*' I'm doing this in a sort of roundabout way because this is exactly what `go mod download` does. The fetch fails, returning status 255, with the below error message: remote: Enumerating objects: 18733, done. remote: Counting objects: 100% (562/562), done. remote: Compressing objects: 100% (448/448), done. remote: Total 18733 (delta 399), reused 144 (delta 112), pack-reused 18171 Receiving objects: 100% (18733/18733), 25.32 MiB | 7.93 MiB/s, done. Resolving deltas: 100% (14608/14608), done. From <VALID-URL> [.... quite a number of branches and tags .....] error: cannot lock ref 'refs/heads/ptv-2164': Unable to create '/Users/joe.drew/tmp/./refs/heads/ptv-2164.lock': File exists. Another git process seems to be running in this repository, e.g. an editor opened by 'git commit'. Please make sure all processes are terminated then try again. If it still fails, a git process may have crashed in this repository earlier: remove the file manually to continue. This file doesn't exist; in fact, no such files exist: $ ls refs/heads $ However, the branch _does_ exist on the remote. This error _does not_ happen in the Apple-supplied version of git: `git version 2.39.5 (Apple Git-154)`, but does in 2.51.0, which I installed with homebrew. (If this is a packaging error, I'll happily report to homebrew.) I'd be more than happy to continue debugging this, though I can't share the repository as it's proprietary. I've also attached the git diagnostics, but they're not particularly helpful, I don't think. [System Info] git version: git version 2.51.0 cpu: arm64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon libcurl: 8.7.1 zlib: 1.2.12 SHA-1: SHA1_DC SHA-256: SHA256_BLK default-ref-format: files default-hash: sha1 uname: Darwin 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6041 arm64 compiler info: clang: 17.0.0 (clang-1700.0.13.3) libc info: no libc information available $SHELL (typically, interactive shell): /opt/homebrew/bin/bash [Enabled Hooks] CONFIDENTIALITY NOTICE AND DISCLAIMER : This telecommunication, including any and all attachments, contains confidential information intended only for the person(s) to whom it is addressed. Any dissemination, distribution, copying or disclosure is strictly prohibited and is not a waiver of confidentiality. If you have received this telecommunication in error, please notify the sender immediately by return electronic mail and delete the message from your inbox and deleted items folders. This telecommunication does not constitute an express or implied agreement to conduct transactions by electronic means, nor does it constitute a contract offer, a contract amendment or an acceptance of a contract offer. Contract terms contained in this telecommunication are subject to legal review and the completion of formal documentation and are not binding until same is confirmed in writing and has been signed by an authorized signatory.
<<attachment: git-diagnostics-2025-08-20-1637.zip>>