git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: windows: error cannot lock ref ... unable to create lock

From
Philip Oakley <philipoakley@iee.org>
Date
Jun 22, 2019, 11:24 UTC
Message-ID
<98e1e1e5-c410-caf1-0e2f-9cb0cc6d7e94@iee.org>
In-Reply-To
<CAPig+cTFfhBz+xiq6VAMNOW4OTvByHJ1g5oF=RTTh_buA+nUQA@mail.gmail.com>
On 18/06/2019 18:01, Eric Sunshine wrote:
Show 23 quoted lines
> On Tue, Jun 18, 2019 at 12:39 PM Anthony Sottile <asottile@umich.edu> wrote:
>> + git fetch origin --tags
>> Unpacking objects: 100% (10/10), done.
>>  From https://github.com/asottile-archive/git-windows-branch-test
>>   * [new branch]      master     -> origin/master
>> error: cannot lock ref 'refs/remotes/origin/pr/aux': Unable to create
>> 'C:/Users/IEUser/x/x/.git/refs/remotes/origin/pr/aux.lock': No such
>> file or directory
>>   ! [new branch]      pr/aux     -> origin/pr/aux  (unable to update local ref)
> AUX is a reserved[1] filename on Windows. Quoting from that source:
>
>      Do not use the following reserved names for the name of a file:
>      CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7,
>      COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and
>      LPT9. Also avoid these names followed immediately by an
>      extension...
>
> The default Git "ref store" is filesystem-based, so a branch named
> "aux" is problematic. Other ref store implementations would not be
> subject to this limitation (though I'm not sure what the state of the
> others is -- someone with more knowledge can probably answer that).
>
> [1]: https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#naming-conventions

This sounds interesting. I thought (but I'm not certain) that Git for Windows avoided creating files in the working tree with such problematic names, so that a clone of a repo that contained a file "AUX" (any case, any extension IIRC), would be bypassed with possibly a warning message.

However this looks to be a slightly different case where a _branch_ called "AUX" (lower cased) has been created within the clone, and it's a problem not trapped. Maybe worth creating a proper issue on the Git-for-Windows repo. Also cc'ing Dscho who may remember better than I. -- Philip

Previous: Anthony SottileNext: Johannes Schindelin
Message 5 of 6 in “windows: error cannot lock ref ... unable to create lock”
  1. Anthony SottileJun 18, 2019
  2. Anthony SottileJun 18, 2019
  3. Eric SunshineJun 18, 2019
  4. Anthony SottileJun 18, 2019
  5. Philip OakleyJun 22, 2019
  6. Johannes SchindelinJun 24, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.