git Eclipse EGIT:当前分支未配置为拉取

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15284706/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 08:17:17  来源:igfitidea点击:

Eclipse EGIT: Current branch not configred for pull

eclipsegitegit

提问by arynaq

I am working on a tilebased RPG with a friend of mine who has to go away for weeks and we decided it was time to use version control/git. I am starting to regret that. After a few hours we managed to get it working to the point where:

我正在和我的一个朋友一起开发基于 tile 的 RPG,他必须离开数周,我们决定是时候使用版本控制/git。我开始后悔了。几个小时后,我们设法让它工作到了以下程度:

  1. I create a repository on github, add him as collaborator.
  2. I commit project in eclipse to git, push
  3. He pulls, gets it imported in his workspace
  4. I make some changes, commit push, he pulls the changes.
  5. He makes some changes, commits and pushes successfully. Changes appear in repo
  6. I try to pull changes, get errors (see image), unsuccessful.
  7. I make some changes, try to commit, get errors, unsuccessful.
  1. 我在 github 上创建了一个存储库,将他添加为合作者。
  2. 我将 eclipse 中的项目提交给 git,push
  3. 他拉,把它导入他的工作区
  4. 我进行了一些更改,提交推送,他提取更改。
  5. 他进行了一些更改,提交并成功推送。更改出现在repo 中
  6. 我尝试进行更改,但出现错误(见图),但未成功。
  7. 我做了一些改变,尝试提交,得到错误,不成功。

Essentially we are locked with a project he can update and I cannot. I am the repo owner if that matters at all.

本质上,我们锁定了一个他可以更新而我不能更新的项目。如果这很重要,我就是回购所有者。

On trying to "Fetch from upstream": "1"

在尝试“从上游获取”时: “1”

On trying to "Pull": "2"

在尝试“拉”时: “2”

On commit&push: "3"

在提交和推送时: “3”

We are pretty much stuck now. We rather not use skype to send files, at some point we are going to be professionals and that seems too tedious.

我们现在几乎被困住了。我们宁愿不使用Skype发送文件,在某些时候我们将成为专业人士,这似乎太乏味了。

As requested: enter image description here

按照要求: 在此处输入图片说明

回答by VonC

The error message "This branch is not configured for pull" in EGit is typical of a branch created locally and pushed.

EGit 中的错误消息“此分支未配置为拉取”是本地创建并推送的分支的典型特征。

That wouldn't set the merge section of that branch.
See "The current branch is not configured for pull No value for key branch.master.mergefound in configuration"

那不会设置该分支的合并部分。
请参阅“当前分支未配置为 pull No value for key branch.master.mergefound in configuration

[branch "master"]
  remote = origin
  merge = refs/heads/master

To solve that, one way is to rename your current masterbranch, and, in the Git Repositoriesview:

要解决这个问题,一种方法是重命名当前master分支,然后在Git Repositories视图中:

  • Right-click on "Branches" / "Switch to" / "New Branch"
  • pull down "Source ref" list, select "master" branch (pull strategy"merge", "Checkout new branch" checked)
  • click "finish"
  • 右键单击“ Branches”/“ Switch to”/“ New Branch
  • 下拉“ Source ref”列表,选择“ master”分支(拉策略merge”,“ Checkout new branch”选中)
  • 点击“ finish

The new branch should be correctly configured

应该正确配置新分支

回答by nidalpres

This worked for me in Eclipse IDE with EGit:

这在带有 EGit 的 Eclipse IDE 中对我有用:

    Open Window->Show view->Other->Git->Git Repositories
    Right click on your repo in Git Repositories view -> Properties
    Click "Add Entry..." button
    key: branch.master.remote
    value: origin
    OK
    Click "Add Entry..." button
    key: branch.master.merge
    value: refs/heads/master
    OK
    Right click on your repo -> Pull

Btw. I'm pulling master from remote and my local branch when pulling is also master.

顺便提一句。我正在从远程和我的本地分支拉主,当拉也是主时。