问题描述
我从Bitbucket或Github迁移了我的回购协议。我不认为这很重要,但它是唯一不同的......有一段时间,我有两个遥控器设置: origin:bitbucket
github:github
然后我删除了两个并指向github的原点:
git remote删除原始地址
git remote删除github
git remote添加原始地址https:// github。 ...
开发分支的测试推送:
git push origin develop
为一些工作创建一个新的分支:
c $ c> git checkout -b功能/名称
更新一个或两个文件。尝试推送到远程:
git push origin特性/名称
这会导致错误:
在线搜索这个问题,找到一些关于确保HEAD正确的东西,其他关于确保我有我的分支名称大小写正确(尽管此时该分支尚不存在于远程)。无法解决。
运行此命令:
git push - -all -u
这让我的功能/名称
分支到github,但仍然看到与之前相同的行为:
git push origin develop
git push origin Feature /名称
第一个作品,第二个作品会抛出相同的错误。
我无法弄清楚为什么我得到这个错误。任何想法?
我也遇到过这个问题,这让我疯狂。我有类似于 feature / name
但是 git branch -a
显示了我 FEATURE / name
。重命名分支,删除并重新创建它,没有任何工作。
进入 .git / refs / heads
您将看到 FEATURE
文件夹。将它重命名为功能
。
I migrated my repos from Bitbucket or Github. I don't think this matters but it's the only thing different... For a little while I had two remotes set up:
origin: bitbucket
github: github
Then I removed both and pointed origin to github:
git remote remove origin
git remote remove github
git remote add origin https://github....
Test push of develop branch:
git push origin develop
Everything up to date, ok, good.
Create a new branch for some work as per usual:
git checkout -b Feature/Name
Update a file or two. Attempt to push to remote:
git push origin Feature/Name
This results in the error:
Search online for this issue, find some stuff about ensuring HEAD is correct, others about making sure I've got my branch name case correct (though, at this point the branch doesn't exist on the remote yet). Unable to resolve.
Ran this command:
git push --all -u
This got my Feature/Name
branch to github, but still see same behavior as prior:
git push origin develop
git push origin Feature/Name
The first works, the second throws the same error.
I can't figure out why I'm getting this error. Any ideas?
I was having this issue as well, and it was driving me crazy. I had something like feature/name
but git branch -a
showed me FEATURE/name
. Renaming the branch, deleting and recreating it, nothing worked. What finally fixed it:
Go into .git/refs/heads
You'll see a FEATURE
folder. Rename it to feature
.
这篇关于无法推送到远程分支,无法解析为分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!