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

Re: [Non-Bug] cloning a repository with a default MASTER branch tries to check out the master branch

From
Philip Oakley <philipoakley@iee.org>
Date
May 23, 2017, 23:24 UTC
Message-ID
<76BD8B6A1511438B8CCB79C616F3BC5B@PhilipOakley>
In-Reply-To
<xmqqa864mea3.fsf@gitster.mtv.corp.google.com>
From: "Junio C Hamano" <gitster@pobox.com>
Show 7 quoted lines
> Félix Saparelli <felix@passcod.name> writes:
>
>> I created a git repository that, for joke reasons, has a single branch
>> called MASTER (in uppercase). Upon cloning this repo, git attempts to
>> checkout the master branch (in lowercase), which does not exist.
>
> See what Git told you carefully and you can guess, I think.
guessing is rarely a good user experience ;-) however...
Show 9 quoted lines
>
>> $ git clone git@github.com:passcod/UPPERCASE-NPM.git
>> Cloning into 'UPPERCASE-NPM'...
>> remote: Counting objects: 14, done.
>> remote: Compressing objects: 100% (11/11), done.
>> remote: Total 14 (delta 3), reused 14 (delta 3), pack-reused 0
>> Receiving objects: 100% (14/14), done.
>> Resolving deltas: 100% (3/3), done.
>> warning: remote HEAD refers to nonexistent ref, unable to checkout.

Perhaps here the warning message could include the value of the ref provided by the remote's HEAD which would then more clearly indicate to the user what was expected.

I haven't had chance to look at how easy that maybe in the code - perhaps a bit of low hanging fruit for someone?

Show 6 quoted lines
>
> So you have MASTER but not master, but your HEAD still is pointing
> at non-existing master.  As HEAD is the way the remote tells the
> clone what the default branch to be checked out is, the command
> reports "we cannot do a checkout of the default branch."
>

-- Philip

Previous: Junio C HamanoNext: Jeff King
Message 3 of 17 in “[Bug] cloning a repository with a default MASTER branch tries to check out the master branch”
  1. Félix SaparelliMay 22, 2017
  2. Junio C HamanoMay 23, 2017
  3. Philip OakleyMay 23, 2017
  4. Jeff KingMay 24, 2017
  5. Junio C HamanoMay 25, 2017
  6. Junio C HamanoMay 25, 2017
  7. Jeff KingMay 25, 2017
  8. Jeff KingMay 25, 2017
  9. Junio C HamanoMay 25, 2017
  10. Philip OakleyMay 26, 2017
  11. Philip OakleyMay 26, 2017
  12. Junio C HamanoMay 27, 2017
  13. Philip OakleyMay 28, 2017
  14. Junio C HamanoMay 28, 2017
  15. Jeff KingMay 31, 2017
  16. Samuel LijinMay 23, 2017
  17. Jeff KingMay 23, 2017

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.