No remotes/origin/HEAD with gitlab

前端 未结 3 1460
心在旅途
心在旅途 2021-01-06 04:47

I\'m pretty new to git, but I\'ve been playing around with it on a remote server I set up and I\'m pretty sure that I understand the basics.

I just set up gitlab and

相关标签:
3条回答
  • 2021-01-06 04:53

    You can set it by command git remote set-head origin -a, which automatically set origin/HEAD to point to appropriate remote branch. Or using git remote set-head origin <branch> to specify a remote branch to point.

    Also see: https://stackoverflow.com/a/8841024/1851492

    0 讨论(0)
  • 2021-01-06 05:02

    Don't worry much about this remote HEAD. This line is simply artifact of the way original clone works, and represents state of remote's HEAD.

    It can be considered as a default branch that is preferred by server (even on remote bare repository) - it will be checked out by your client git clone by default if -b branch option was not used.

    Your local file .git/refs/remotes/origin/HEAD probably contains string ref: refs/remotes/origin/master now. You can remove it if you want (not that I recommend doing it, mind you), and git branch -a will not show it anymore.

    Except for this usage of remote HEAD as default branch for first clone, for you state of remote HEAD never matters. You should only worry about state of real remote branches, not remote HEAD as it only makes sense for remote state as its default selected branch. And if remote is bare repository, it does not make much sense even on remote.

    And the reason why you did not see remote HEAD when you did git remote add ..., git fetch, git pull is because in that case git did not have to make a decision on which default remote branch to pickup by default.

    0 讨论(0)
  • 2021-01-06 05:20

    I solve my problem in this way

    1. First delete the index file in the .git folder.
    2. Then open terminal and type git reset
    0 讨论(0)
提交回复
热议问题