Why does git not recognize “origin/master” as a valid object name?

后端 未结 3 751
无人及你
无人及你 2021-02-19 07:27
~/www> git branch --track live origin/master
fatal: Not a valid object name: \'origin/master\'.
~/www> git remote
origin
~/www> git branch
* master
  test_branc         


        
3条回答
  •  青春惊慌失措
    2021-02-19 07:36

    Your output from git remote confirms that you've successfully added your origin remote.

    I expect the problem is that you haven't yet created the remote-tracking branch(es). If you do git branch -r, it probably won't output anything. So origin/master is not a valid object name because that remote-tracking branch doesn't exist yet.

    The solution is to do git fetch origin to create the remote-tracking branch(es). If you then do git branch -r, you'll see origin/master now exists.

提交回复
热议问题