# Git fetch Failure

3 messages from 2025-09-02 to 2025-09-02. Participants: Tarun【ツ】, Kristoffer Haugsbakk, Karthik Nayak.
Thread: https://gitlist.dev/t/64072

## Tarun【ツ】, 2025-09-02 14:08

Subject: Git fetch Failure
Message-ID: <CAGAx-2Ac2Tt4-jTH=AApK3m=U7d2RJBaTW=uX6jBHzmpWU9NYw@mail.gmail.com>
URL: https://gitlist.dev/e/CAGAx-2Ac2Tt4-jTH%3DAApK3m%3DU7d2RJBaTW%3DuX6jBHzmpWU9NYw%40mail.gmail.com

```
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)

I am trying to clone the repo from cmdline. the same steps succeeds
with git v2.50.1 but fails with git v 2.51.0


repro steps


mkdir TasksTest

cd TasksTest

git init

git remote add origin https://github.com/microsoft/azure-pipelines-tasks.git

git fetch


What did you expect to happen? (Expected behavior)

Git fetch to succeed


What happened instead? (Actual behavior)

Git fetch failed with error

error: cannot lock ref
'refs/remotes/origin/users/ajya/sqlservermoduleimportM146': Unable to
create '/Users/admin/Repos/tasks1/.git/refs/remotes/origin/users/ajya/sqlservermoduleimportM146.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.




What's different between what you expected and what actually happened?


Anything else you want to add:


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.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:29
PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000 arm64

compiler info: clang: 17.0.0 (clang-1700.0.13.3)

libc info: no libc information available

$SHELL (typically, interactive shell): /bin/zsh



[Enabled iHooks]

```

## Kristoffer Haugsbakk, 2025-09-02 14:46

Subject: Re: Git fetch Failure
Message-ID: <829c6e09-c834-461f-820d-981512a02a76@app.fastmail.com>
URL: https://gitlist.dev/e/829c6e09-c834-461f-820d-981512a02a76%40app.fastmail.com
In-Reply-To: <CAGAx-2Ac2Tt4-jTH=AApK3m=U7d2RJBaTW=uX6jBHzmpWU9NYw@mail.gmail.com>

```
On Tue, Sep 2, 2025, at 16:08, Tarun【ツ】 wrote:
>[snip]
> What happened instead? (Actual behavior)
>
> Git fetch failed with error
>
> error: cannot lock ref
> 'refs/remotes/origin/users/ajya/sqlservermoduleimportM146': Unable to
> create
> '/Users/admin/Repos/tasks1/.git/refs/remotes/origin/users/ajya/sqlservermoduleimportM146.lock':
> File exists.
>[snip]
> [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:29
> PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000 arm64
>
> compiler info: clang: 17.0.0 (clang-1700.0.13.3)
>
> libc info: no libc information available
>
> $SHELL (typically, interactive shell): /bin/zsh
>
>
>
> [Enabled iHooks]

It looks like a casing issue caused by `default-ref-format: files`.

ˋˋˋ
$ git for-each-ref --format='%(refname)' | grep -i sqlServerModuleImportM146
refs/remotes/origin/users/ajya/sqlServerModuleImportM146
refs/remotes/origin/users/ajya/sqlservermoduleimportM146
ˋˋˋ

You could try

ˋˋˋ
$ git clone --ref-format=reftable https://github.com/microsoft/azure-pipelines-tasks.git
ˋˋˋ

-- 
Kristoffer Haugsbakk


```

## Karthik Nayak, 2025-09-02 20:28

Subject: Re: Git fetch Failure
Message-ID: <CAOLa=ZQZL3hZE_3ajCAA5=41PZLAVOE=rnPJexu4nPGibNgvRA@mail.gmail.com>
URL: https://gitlist.dev/e/CAOLa%3DZQZL3hZE_3ajCAA5%3D41PZLAVOE%3DrnPJexu4nPGibNgvRA%40mail.gmail.com
In-Reply-To: <829c6e09-c834-461f-820d-981512a02a76@app.fastmail.com>

```
"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:

> On Tue, Sep 2, 2025, at 16:08, Tarun【ツ】 wrote:
>>[snip]
>> What happened instead? (Actual behavior)
>>
>> Git fetch failed with error
>>
>> error: cannot lock ref
>> 'refs/remotes/origin/users/ajya/sqlservermoduleimportM146': Unable to
>> create
>> '/Users/admin/Repos/tasks1/.git/refs/remotes/origin/users/ajya/sqlservermoduleimportM146.lock':
>> File exists.
>>[snip]
>> [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:29
>> PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000 arm64
>>
>> compiler info: clang: 17.0.0 (clang-1700.0.13.3)
>>
>> libc info: no libc information available
>>
>> $SHELL (typically, interactive shell): /bin/zsh
>>
>>
>>
>> [Enabled iHooks]
>
> It looks like a casing issue caused by `default-ref-format: files`.
>
> ˋˋˋ
> $ git for-each-ref --format='%(refname)' | grep -i sqlServerModuleImportM146
> refs/remotes/origin/users/ajya/sqlServerModuleImportM146
> refs/remotes/origin/users/ajya/sqlservermoduleimportM146
> ˋˋˋ
>
> You could try
>
> ˋˋˋ
> $ git clone --ref-format=reftable https://github.com/microsoft/azure-pipelines-tasks.git
> ˋˋˋ
>

Yeah, so the issue is that using the files backend on case-insensitive
filesystems breaks since there are conflicts due to references with only
case difference. Before 2.51 we would simply overwrite one reference
with the other _silently_. With 2.51 we use a single transaction for
reference update and this breaks.

There was another report similar to this [1] and I've also pushed
patches to overcome this issue [2]. But with the files backend, there
will always be a compromise.

So like Kristoffer suggested, the best path is to use the reftable
backend, which can handle different cases in references.

[1]: https://lore.kernel.org/all/YQXPR01MB3046197EF39296549EE6DD669A33A@YQXPR01MB3046.CANPRD01.PROD.OUTLOOK.COM/
[2]: https://lore.kernel.org/all/20250902-587-git-fetch-1-fails-fetches-on-case-insensitive-repositories-v1-0-35e69bbb507d@gmail.com/

> --
> Kristoffer Haugsbakk

```
