34060

Question:
There is a git repository in my LAN. I try to query Git to list all the HEAD references in the following way:
<strong>Method 1</strong>
<em>Command</em>
git ls-remote -h username@{ip-address}:/path/to/repo
<em>Output</em>
f0467f266dee55cd32f2ca6fa819814f367db899 HEAD
<strong>Method 2</strong>
<em>Command</em>
git ls-remote username@{ip-address}:/path/to/repo HEAD
<em>Output</em>
f0467f266dee55cd32f2ca6fa819814f367db899 HEAD
<strong>Method 3</strong>
<em>Command</em>
git ls-remote -h username@{ip-address}:/path/to/repo HEAD
When using the above command, the head reference which was listed in the above two methods is not listed.
Any idea on this?
Answer1:I suspect this is because HEAD
is a special kind of refs, it's not a head of a branch, it doesn't reside in refs/heads/
namespace. So when you ask git to list refs with both -h
and HEAD
git sees a contradiction and doesn't list any refs.