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

Re: git clone - not getting the correct default branch

From
TCTomas Carnecky <tomas.carnecky@gmail.com>
Date
Apr 18, 2012, 13:53 UTC
Message-ID
<1334757203-ner-3478@calvin>
In-Reply-To
<CAE5ih7-KmknO8aD=ws-GnUw2RO4fLzscdNYsxkUsFD0Y=28iew@mail.gmail.com>
On Wed, 18 Apr 2012 14:05:14 +0100, Luke Diamand <luke@diamand.org> wrote:
Show 20 quoted lines
> A bit weird this.
> 
> I have a bare repo (managed with gitolite) which, when I clone it,
> always comes up with origin/HEAD pointed to origin/master.
> 
> This despite the fact that on the repo, HEAD is a symbolic ref to origin/dev.
> 
> i.e.
> 
> % git clone git@myserver:myrepo
> ...
> % git branch
> * master
> 
> % ssh myserver
> % cd /path/to/myrepo.git
> % cat HEAD
> ref: refs/heads/dev
> 
> What could be going wrong? Other repos don't have this problem.

Does master and dev in the repo on the server point to the same commit? Because the git protocol does not expose which *branch* HEAD points to, only which *commit*. So if two branches point to the same commit, git just takes the first branch and points the local HEAD to that.

tom
Previous: Luke Diamand
Message 2 of 2 in “git clone - not getting the correct default branch”
  1. Luke DiamandApr 18, 2012
  2. Tomas CarneckyApr 18, 2012

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.