gpt4 book ai didi

git - 致命的 : The upstream branch of your current branch does not match the name of your current branch

转载 作者:IT王子 更新时间:2023-10-29 00:45:37 32 4
gpt4 key购买 nike

在使用 Git GUI 检查远程分支 releases/rel_5.4.1 之后,当我尝试 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

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

git status 说我在分支 rel_5.4.1 上。

这是出现在我的 .git/config 中的分支:

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

这是怎么回事?

最佳答案

如果上游分支和本地分支的名称不匹配,就会发生这种情况,这种情况有时会发生,而且通常是不需要的:

> git status
On branch release-1.2.3
Your branch is up to date with 'origin/master'.

要解决这个问题,运行:

git branch --unset-upstream

然后,一旦您再次运行 git push,您将被要求使用 --set-upstream 选项来正确设置上游分支。

关于git - 致命的 : The upstream branch of your current branch does not match the name of your current branch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24864700/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com