致命:当前分支的上游分支与当前分支的名称不匹配 [英] fatal: The upstream branch of your current branch does not match the name of your current branch

查看:2295
本文介绍了致命:当前分支的上游分支与当前分支的名称不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用Git GUI检查远程分支 releases / rel_5.4.1 后,当我尝试<$ c $时看到这个意外的错误消息c> push :

 致命:当前分支的上游分支不匹配
当前分支的名称。要推送到远程的上游分支
,请使用

git push origin HEAD:releases / rel_5.4.1

要推送到同名的分支在遥控器上,使用

git push origin rel_5.4.1

I don不知道Git在谈论什么。我可能想推到 origin releases / rel_5.4.1 ,因为那是我检出的分支。所以这两个选项对我来说似乎都不正确。



git status 说我在分支 rel_5.4.1



这是分支,因为它出现在我的 .git / config

$ $ $ $ $ $ $ $ $ $ $ $ $ $
$ merge $ refs /头/发布/ rel_5.4.1

发生了什么事?


<您的本地分支名为 rel_5.4.1 ,但远程分支是 releases / rel_5.4.1 (就Git而言, / 在分支名称中没有特殊含义,除了使它们更容易阅读



当你推送时,Git会提醒你是否要将分支推送到 releases / rel_5.4.1 (远程分支的名称)或是否要创建新的远程分支。不过,它确实注意到了名称的相似性。



除非要创建新分支,否则正确的命令是

  git push origin HEAD:releases / rel_5.4.1 

您也可以使用

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

要一劳永逸地修复警告,请重命名您的本地分支以匹配远程名称:

  git branch -m releases / rel_5.4.1 


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:

fatal: The upstream branch of your current branch does not match
the name of your current branch.  To push to the upstream branch
on the remote, use

    git push origin HEAD:releases/rel_5.4.1

To push to the branch of the same name on the remote, use

    git push origin rel_5.4.1

I don't know what Git is talking about. I probably want to push to origin releases/rel_5.4.1 since that's the branch which I checked out. So neither option seems correct to me.

git status says I'm on branch rel_5.4.1.

Here is the branch as it appears in my .git/config:

[branch "rel_5.4.1"]
    remote = origin
    merge = refs/heads/releases/rel_5.4.1

What is going on?

解决方案

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

这篇关于致命:当前分支的上游分支与当前分支的名称不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆