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

Re: Bug when cloning a repository with a default branch called HEAD

From
Aasymptosis <asymptosis@posteo.net>
Date
May 31, 2021, 04:37 UTC
Message-ID
<YLRoAIBExd+dAe0C@sleipnir.acausal.realm>
In-Reply-To
<07edafe5-d0a2-4a2c-12a2-28c163f6fdda@gmail.com>
Show 11 quoted lines
>I'm trying to create minimal reproducible test repo by switching 
>initial branch to HEAD:
>
>$ mkdir shark && cd shark
>$ git init
>$ git checkout -b HEAD
>
> /snip
>
>The remote [1] might misconfigured default branch, so instead of 
>master/main it pointed to HEAD, and it caused the issue.
Hi Bagas,
I think he meant the remote had its default branch set to HEAD before he tried cloning. I.e. reproducing the error would look something more like this:

#! /bin/bash remote_repo=/tmp/remote local_repo=/tmp/local mkdir $remote_repo cd $remote_repo git init -b HEAD touch README git add -A && git commit -m "Initial commit" cd .. git clone $remote_repo $local_repo

For me, the generated /tmp/local repo does issue warnings about ambiguous HEAD ref. However, it still works, and I don't get the wild errors like reported by Björn.
I suspect it's something to do with the implementation on the local OS. I'm on Linux and it seems like Björn is using Windows.
Previous: Bagas SanjayaNext: Björn Kautler
Message 3 of 6 in “Bug when cloning a repository with a default branch called HEAD”
  1. Björn KautlerMay 28, 2021
  2. Bagas SanjayaMay 31, 2021
  3. asymptosisMay 31, 2021
  4. Fwd: Bug when cloning a repository with a default branch called HEADBjörn Kautler, May 31, 2021
  5. Randall S. BeckerMay 31, 2021
  6. Björn KautlerMay 31, 2021

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.