Error on branch creation: “warning: refname 'master' is ambiguous.”

后端 未结 2 1964
南笙
南笙 2021-02-15 16:42

I\'ve had simple project being managed in a Git repository. To date I haven\'t intentionally created any branches, but when I tried to create my first today using



        
相关标签:
2条回答
  • 2021-02-15 16:58

    The rules for how revision specifications are interpreted are given in gitrevisions(7) (referenced from git(1), among other bits of documentation).

    In short, master matches two patterns when applied to the refs in your repository: a local branch (refs/heads/<name>) and the default remote-tracking branch of a remote (refs/remotes/<name>/HEAD).

    These can be disambiguated by using heads/master for the local branch and master/HEAD (or master/master in your case) for the remote-tracking branch.

    As Andrew Marshall mentions, you might want to rename your remote to avoid having to disambiguate in the first place.

    0 讨论(0)
  • 2021-02-15 17:16

    It seems it's ambiguous because your remote name and branch name are both master. You can try renaming the remote to the more conventional origin by running

    git remote rename master origin
    
    0 讨论(0)
提交回复
热议问题