Why does git branch -t fail with “Not tracking: ambiguous information”?

后端 未结 5 1865
面向向阳花
面向向阳花 2021-02-03 21:10

When I try to create a new branch tracking a remote branch, I get this:

$ git branch -t test origin/foo
error: Not tracking: ambiguous information for ref refs/r         


        
5条回答
  •  佛祖请我去吃肉
    2021-02-03 21:15

    None of the other fixes mentioned here worked for me. The one that ended up working was this:

    $ git branch -t test origin/test
    error: Not tracking: ambiguous information for ref refs/remotes/origin/test
    

    After running the above, even though git complained, it did end up creating a local branch test but no upstream set.

    Now, I opened the .git/config file (which did not have any record of a branch test) and added the following manually:

    [branch "test"]
            remote = origin
            merge = refs/heads/test
    

    After which everything worked fine.

提交回复
热议问题