fatal: The upstream branch of your current branch does not match the name of your current branch

前端 未结 5 841
时光说笑
时光说笑 2020-12-07 14:31

After doing a checkout of the remote branch releases/rel_5.4.1 using the Git GUI, I\'m seeing this unexpected error message when I try to push:

5条回答
  •  我在风中等你
    2020-12-07 15:02

    Your local branch is called rel_5.4.1 but the remote branch is releases/rel_5.4.1 (as far as Git is concerned, the / has no special meaning in branch names except to make them easier to read for the human eye).

    When you push, Git is wary whether you want to push your branch to releases/rel_5.4.1 (the name of the remote branch) or whether you want to create a new remote branch. It does notice the similarity of names, though.

    Unless you want to create a new branch, the correct command is

    git push origin HEAD:releases/rel_5.4.1
    

    You could also use

    git push origin rel_5.4.1:releases/rel_5.4.1
    

    To fix the warning once and for all, rename your local branch to match the remote name:

    git branch -m releases/rel_5.4.1
    

提交回复
热议问题