在 Eclipse 中拉入 git 存储库时出现“无法为分支发布广告参考...”错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14033442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"Could not get advertised Ref for branch..." error when pulling in a git repository in Eclipse
提问by Piotr Dobrogost
When trying to pull (Team|Pull from the context menu) in a git repository in Eclipse I get Could not get advertised Ref for branch refs/heads/develop
error. I guess that's because remote branch named develop
was deleted in the meantime. Branch develop
is currently checked out.
尝试在 Eclipse 的 git 存储库中拉取(团队|从上下文菜单中拉取)时Could not get advertised Ref for branch refs/heads/develop
出现错误。我猜那是因为develop
同时删除了名为远程的分支。分支develop
当前已签出。
How to fix this?
Can I configure git and/or Eclipse so that I don't get this error next time some other remote branch gets deleted?
如何解决这个问题?
我可以配置 git 和/或 Eclipse 以便下次删除其他远程分支时不会出现此错误吗?
采纳答案by VonC
As I mention in "How do you stop tracking a remote branch in git?", you can unset the associated remote tracking branch with:
正如我在“如何停止在 git 中跟踪远程分支?”中提到的,您可以使用以下命令取消设置关联的远程跟踪分支:
git config --unset branch.develop.remote
git config --unset branch.develop.merge
It is certainly possible to edit the fetch/push specifications of a branch in EGit (see "Direct Fetch and Push Support "), but I find it so much quicker through the git CLI (command line interface).
当然可以在 EGit 中编辑分支的获取/推送规范(请参阅“直接获取和推送支持”),但我发现通过 git CLI(命令行界面)速度要快得多。
回答by Jake Toronto
I had the same error, and so I made sure my .git/config
file had the following:
我有同样的错误,所以我确保我的.git/config
文件有以下内容:
[branch "mybranch"]
remote = origin
merge = refs/heads/mybranch
That made EGit happy.
这让 EGit 很高兴。
回答by Line
I had this problem when I messed up with branch name - can't pull despite of the fact that the branch was present in origin.
当我弄乱分支名称时遇到了这个问题 - 尽管分支存在于原始位置,但无法拉动。
I "solved" it by switching to another branch and then pull.
我通过切换到另一个分支然后拉动来“解决”它。
回答by Archmede
I solved this issue by
我解决了这个问题
git push --set-upstream origin <branch_name>
git push --set-upstream origin <branch_name>
回答by Isa Wang
I got this error after removed the remote branch and pull the corresponding branch on local, so the resolve solution is easy:
删除远程分支并在本地拉出相应的分支后出现此错误,因此解决方案很简单:
- switch to valid branch then pull
- or push local branch to remote
- or set another remote branch for local branch
- ... any such operations can help
- 切换到有效分支然后拉
- 或将本地分支推送到远程
- 或为本地分支设置另一个远程分支
- ...任何此类操作都可以提供帮助