Git command - Repository heads not listed while using -h switch with “HEAD” option

痞子三分冷 提交于 2019-12-13 03:41:58

问题


There is a git repository in my LAN. I try to query Git to list all the HEAD references in the following way:

Method 1

Command

git ls-remote -h username@{ip-address}:/path/to/repo

Output

f0467f266dee55cd32f2ca6fa819814f367db899    HEAD

Method 2

Command

git ls-remote username@{ip-address}:/path/to/repo HEAD

Output

f0467f266dee55cd32f2ca6fa819814f367db899    HEAD

Method 3

Command

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?


回答1:


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.



来源:https://stackoverflow.com/questions/50131377/git-command-repository-heads-not-listed-while-using-h-switch-with-head-opti

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!