There appears to be some weirdness here - git isn't properly looking at the HEAD of the remote repository
#!/bin/bash
(mkdir project && cd project && git init -q && touch a && git add a && git commit -q -m "add a" && git checkout -q -b pu) && git clone -q project project.clone && (cd project.clone && echo -n "HEAD: " && git symbolic-ref HEAD && echo -n "origin/HEAD: " && git symbolic-ref refs/remotes/origin/HEAD && git remote show origin)
The output is:
HEAD: refs/heads/master
origin/HEAD: refs/remotes/origin/master
* remote origin
Fetch URL: /home/jefromi/sandbox/project
Push URL: /home/jefromi/sandbox/project
HEAD branch (remote HEAD is ambiguous, may be one of the following):
master
pu
8< more git remote output 8<So somehow, the clone misses the fact that origin's HEAD is pu, not master, and git remote is only partially aware of this. It looks like this only happens when the two branches in question are pointing to the same commit; perhaps git is trying to guess what HEAD is via the SHA1? I know that ls-remote prints an SHA1, not a refname, for HEAD - is it not actually possible to get that information through a general transport protocol?
Jeffrey