git 当前分支未配置为 pull 配置中找不到 key branch.master.merge 的值

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

The current branch is not configured for pull No value for key branch.master.merge found in configuration

eclipsegitegit

提问by Ismail Marmoush

I get this error when I try to pull from remote repository using Egit team>pull

当我尝试使用 Egit team>pull 从远程存储库拉取时出现此错误

The current branch is not configured for pull No value for key branch.master.merge found in configuration

当前分支未配置为 pull 配置中找不到 key branch.master.merge 的值

采纳答案by Micha? Szajbe

Your local master branch is not set up to track remote master branch.

您的本地 master 分支未设置为跟踪远程 master 分支。

You could do git pull origin masterto tell git the explicit branch you want to pull or you add this to your .git/config:

您可以git pull origin master告诉 git 您要拉取的显式分支,或者将其添加到 .git/config 中:

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

When you push to master for the first time, add the -uswitch (git push -u origin master). This will set everything up automatically.

当您第一次推送到 master 时,添加-u开关 ( git push -u origin master)。这将自动设置所有内容。

回答by gview

As it turns out, @Micha? Szajbe's answer IS the solution to the problem. The eclipse keys in question are built from the egit "working directory". Should you encounter this problem, then find the .git directory in that working directory and edit the .git/config file with a text editor, adding the section Michal describes. This is in my experience a fairly standard operation these days for cases when you first git init and push to an uninitialized remote, that creates the master branch. I haven't found a way in that case not to do the manual editing in order to git pull, even with command line git.

事实证明,@Micha?Szajbe 的回答是问题的解决方案。有问题的 eclipse 键是从 egit“工作目录”构建的。如果您遇到此问题,请在该工作目录中找到 .git 目录并使用文本编辑器编辑 .git/config 文件,添加 Michal 描述的部分。根据我的经验,这在如今的情况下是一种相当标准的操作,适用于您第一次 git init 并推送到未初始化的远程,从而创建主分支的情况。在这种情况下,即使使用命令行 git,我还没有找到不进行手动编辑以 git pull 的方法。

After the edit is saved, right click on the git repo in your egit "Git Repositories" perspective, and choose properties, you will now see this section of keys has been created (or more likely just read from the config file) and a remote master to local master git pull will operate as expected going forward.

保存编辑后,在 egit “Git Repositories” 透视图中右键单击 git repo,然后选择属性,您现在将看到这部分密钥已创建(或者更有可能只是从配置文件中读取)和一个远程master 到本地 master git pull 将按预期运行。

enter image description here

在此处输入图片说明

It's possible that you could enter these keys and values yourself, but copying and pasting what Michal shows is certainly a lot faster and probably safer. I didn't actually try adding the keys manually through the property editor nor am I likely to, as I know this method works, and makes sense since egit is simply calling through to the local git repo.

您可以自己输入这些键和值,但复制和粘贴 Michal 显示的内容肯定要快得多,而且可能更安全。我实际上并没有尝试通过属性编辑器手动添加键,我也不太可能尝试,因为我知道这种方法有效,并且很有意义,因为 egit 只是调用本地 git 存储库。

I am also supporting some people in my office who are using Flex and the Flexbuilder editor which is built on top of eclipse and egit. These instructions are equally relevant to them.

我还支持我办公室中使用 Flex 和构建在 eclipse 和 egit 之上的 Flexbuilder 编辑器的一些人。这些说明与他们同样相关。

回答by Marco Lackovic

To fix this problem in Eclipse, open the Windowsmenu and select Show View/ Other/ Git Repositories.

要在 Eclipse 中解决此问题,请打开Windows菜单并选择Show View/ Other/ Git Repositories

From the Git Repositories tab:

从 Git 存储库选项卡:

  • expand your local repository
  • right click on Remote
  • click on Create Remote...
  • Remote name = origin
  • next to IRIpress the Changebutton
  • CTRL+SPACEon URI
  • select the remote location
  • press Finish
  • press Save and Push
  • 扩展您的本地存储库
  • 右键单击远程
  • 单击创建远程...
  • 远程名称 = 来源
  • IRI旁边按更改按钮
  • CTRL+ SPACEURI
  • 选择远程位置
  • 完成
  • 保存并推送

Again, from the Git Repositories tab:

同样,从 Git Repositories 选项卡:

  • right click on origin
  • select Configure Fetch...
  • on Ref mapping press the Edit (Advanced)...
  • press Add All Branches Spec
  • select the Force Updatecheckbox
  • press Finish
  • 右键单击原点
  • 选择配置获取...
  • 在 Ref mapping 上按Edit (Advanced)...
  • 添加所有分支规范
  • 选择强制更新复选框
  • 完成

Again, from the Git Repositories tab:

同样,从 Git Repositories 选项卡:

  • right click on your local repository
  • select Properties
  • press New Entry...
  • enter the following two keys:
  • 右键单击您的本地存储库
  • 选择属性
  • 新条目...
  • 输入以下两个键:

(1)

(1)

Key = branch.master.remote
Value = origin

(2)

(2)

Key = branch.master.merge
Value = refs/heads/master

回答by Zip184

This worked for me:

这对我有用:

Right-click my checked-out local branch that can't pull (mine's called "development") Select "Configure Branch..." For "Upstream Branch:", I selected "refs/heads/development" For "Remote:" I selected "origin" Left "Rebase" unchecked Hit OK

右键单击我签出的无法拉取的本地分支(我的称为“开发”)选择“配置分支...”对于“上游分支:”,我为“远程:”选择了“refs/heads/development”我选择了“原点”左“变基”未选中点击确定

Now my config pref window looks like the one in gview's answer.

现在我的配置首选项窗口看起来像 gview 的答案中的那个。

回答by chelder

I also had problems to configure it. It is working now so I'm going to share my configuration file. I think it will help:

我也有配置它的问题。它现在正在工作,所以我要分享我的配置文件。我认为这会有所帮助:

[core]
    repositoryformatversion = 0
    filemode = false
    logallrefupdates = true

    [branch "master"] 
        remote = origin 
        merge = refs/heads/master 
    [remote "origin"] 
        url = https://github.com/chelder86/ArcadeTongame.git
        fetch = +refs/heads/*:refs/remotes/origin/*

Note: https://github.com/chelder86/ArcadeTongame.gitshould be replaced with your own HTTPS clone URL.

注意:https://github.com/chelder86/ArcadeTongame.git应替换为您自己的 HTTPS 克隆 URL。

回答by ian scott-fleming

Same problem. Here's how I solved it within eclipse/egit:

同样的问题。这是我在 eclipse/egit 中解决它的方法

Originally I cloned a remote repo to my office computer (my own repo, but on a remote server). Then I created a new branch of repo project locally ("testing"), and pushed it to remote repository. Cloned remote repo to my laptop, switched to "testing" branch, worked on it, etc., pushed, then came back to office. When I tried to pull "testing" changes from server, got msg "local branch not configured for pull".

最初我将远程仓库克隆到我的办公室计算机(我自己的仓库,但在远程服务器上)。然后我在本地创建了一个 repo 项目的新分支(“testing”),并将其推送到远程存储库。将远程仓库克隆到我的笔记本电脑,切换到“测试”分支,对其进行处理,等等,推送,然后回到办公室。当我尝试从服务器拉取“测试”更改时,收到消息“本地分支未配置拉取”。

Problem is that on desktop, "testing" is local only, does not have remote URL info, so cannot pull changes.

问题是在桌面上,“测试”仅在本地进行,没有远程 URL 信息,因此无法提取更改。

I solved this within eclipse (egit)by:

在 eclipse (egit) 中通过以下方式解决了这个问题:

  1. deleting local branch
  2. pull branch from remote repo as new branch.
  1. 删除本地分支
  2. 从远程仓库拉取分支作为新分支。

Steps were:

步骤是:

  • Go to Git Repository Exploring perspective
  • rename local branch "zzz" (paranoid, don't like deleting until sure I've got it right!)
  • rt-click "Branches", "Switch to", "New Branch"
  • pull down "Source ref" list, select "testing" branch (pull strategy "merge", "Checkout new branch" checked)
  • click "finish"
  • Switch to usual perspective, make sure my files are present
  • switch back to Git Repository Exploring and delete branch "zzz"
  • 转到 Git 存储库探索视角
  • 重命名本地分支“zzz”(偏执,不喜欢删除,直到确定我做对了!)
  • rt-单击“分支”、“切换到”、“新建分支”
  • 下拉“Source ref”列表,选择“testing”分支(拉取策略“merge”,“Checkout new branch”勾选)
  • 点击“完成”
  • 切换到通常的视角,确保我的文件存在
  • 切换回 Git Repository Exploring 并删除分支“zzz”

Note: am running Eclipse Indigo . Steps may be different on other releases.

注意:我正在运行 Eclipse Indigo 。其他版本的步骤可能不同。

回答by blue-sky

I just got the same issue but accepted answer did not work for me. Here's what I did (although I can't confirm if accepted answer had an impact as the updated config remains) :

我刚刚遇到了同样的问题,但接受的答案对我不起作用。这就是我所做的(虽然我无法确认接受的答案是否有影响,因为更新的配置仍然存在):

Expand your git repository tree from 'Git Repositories' view.

Right click on 'Remotes' and select 'Create Remote'

Select radio button 'Configure fetch' -> 'Ok'

Select 'Change' opposite 'URI' text box

Enter your git repository details and click 'Finish'

Select 'Save'

从“Git 存储库”视图展开您的 git 存储库树。

右键单击“遥控器”并选择“创建遥控器”

选择单选按钮“配置提取”->“确定”

选择“URI”文本框对面的“更改”

输入您的 git 存储库详细信息,然后单击“完成”

选择“保存”

You should now be able to pull from the remote repository.

您现在应该能够从远程存储库中提取。

Note - when I tried 'Dry-Run' which I think is just a connection test it failed but the pull still worked.

注意 - 当我尝试“干运行”时,我认为这只是一个连接测试,它失败了,但拉动仍然有效。

回答by mike

About gview's solution:

关于gview的解决方案:

then find the .git directory in that working directory and edit the .git/config file with a text editor

You don't need to find it yourself or open it with a text editor.

您无需自己查找或使用文本编辑器打开它。

  • Window -> Show view -> Other -> GIT -> Git Repositories
  • Expand the repo folder you created.
  • It will contain a folder called "Working Directory" expand it.
  • There will be a folder inside the "Working Directory" folder called ".git" expand it.
  • Inside ".git" there will be "config", right click "config" -> open in editor. The config file will open right in Eclipse where you can edit it. I added the following and now I can pull without errors:
  • 窗口 -> 显示视图 -> 其他 -> GIT -> Git 存储库
  • 展开您创建的 repo 文件夹。
  • 它将包含一个名为“工作目录”的文件夹展开它。
  • “工作目录”文件夹中将有一个名为“.git”的文件夹展开它。
  • 在“.git”里面会有“config”,右键单击“config”->在编辑器中打开。配置文件将在 Eclipse 中打开,您可以在其中进行编辑。我添加了以下内容,现在我可以毫无错误地拉取:

[branch "master"]

[分支“大师”]

remote = origin

远程 = 原点

merge = refs/heads/master

合并 = refs/heads/master

回答by piotrek

git repository view -> + branches -> local -> select the local branch you want to assign to the remote one -> right click -> select the remote (probably origin) and the upstream branch

git repository 查看-> + 分支-> 本地-> 选择要分配给远程的本地分支-> 右键单击​​-> 选择远程(可能是origin)和上游分支

回答by user11435

Try windows->Show View->Navigator. In the Navigator windows, find bin folder in your project Then commit bin folder to github and hope it work well. Try pull or fetch it after all task above.

尝试窗口-> 显示视图-> 导航器。在 Navigator 窗口中,找到项目中的 bin 文件夹,然后将 bin 文件夹提交到 github 并希望它运行良好。在完成上述所有任务后尝试拉取或获取它。