165

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

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

Ismail Marmoush
  • 13,140
  • 25
  • 80
  • 114
  • 2
    Had the same issue but for value for key remote.origin.url found how fix this on http://stackoverflow.com/a/10662106/759452 – Adriano Nov 19 '12 at 18:02

17 Answers17

156

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

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

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

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

Michał Szajbe
  • 8,830
  • 3
  • 33
  • 39
  • 25
    But how do you do this in eclipse? I believe the question is tagged as "eclipse". Thanks! :) – jamesmortensen Jan 12 '12 at 17:10
  • 2
    +1 Thanks anyway. Your answer *did* help because it turns out we weren't set up to pull :) Once we figured out how to configure that in Eclipse, things came together. We're now finding that Git isn't all that painful to work with once you wrap your head around the way it works. We basically checked out the repository again and configured it to pull. – jamesmortensen Jan 16 '12 at 18:51
  • 16
    @jmort253 would be great if you were to update the question with the details of what you had to change in eclipse to configure this. – gview Mar 13 '12 at 21:02
  • @gview - Sorry, I stopped using Egit and am using the command line. When I pull, Eclipse marked any files my colleagues committed as modified by me and wouldn't include the changes. So, I'm using the command line. I do not recommend EGit; however, my colleagues using Macs are able to use it. If I do try to give it another chance (doubtful), I'll update the answer here. Quite frankly, I don't see what all the hype is about. I'm ready to move back to Subversion. – jamesmortensen Mar 14 '12 at 05:27
  • 9
    @jmort253, after i left you the message, I poked around and figured out that the best way to handle this is to do exactly what was recommended in the original reply. Egit reads the values from the .git/config, so editing it with a text editor as described, fixes the problem. – gview Mar 14 '12 at 08:06
  • @jmort253: having used svn extensively for a number of years, git is just so much better than svn in so many ways, particularly in the realm of branching. Just as it took me a while to understand how svn works, and how to accomplish things it took me a while to understand git. The problem with egit is that it really requires a good knowledge of how git works, and it's far more complicated than svn with subclipse for example. Once you understand the power and usefulness of local branches, you'll understand git. You're more likely to figure this out with command line git in my opinion. – gview Mar 14 '12 at 08:12
  • @gview - Thanks for the encouragement. BTW Congrats on figuring out how to configure Egit. Maybe you should edit the answer. I might give EGit a shot again later on down the road after we get past our first product release goal. :) – jamesmortensen Mar 14 '12 at 16:16
  • @jmort253 see the answer by Zip184 he outlines how to do it in Eclipse – Clarence Liu Jun 13 '13 at 01:27
  • @ClarenceLiu - Thanks for the heads up; however, I've found that life is just much *much* simpler using git the way it was designed to be used, from the command line. Why? When searching a problem, a large percentage of the solutions involve the command line. Hope this helps! :) – jamesmortensen Jun 13 '13 at 01:49
  • There is no need to edit the config file for me. I just do "git push -u origin master" once and it is fixed automatically. – Jeremy Nov 20 '13 at 06:57
64

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.

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.

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.

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.

gview
  • 14,876
  • 3
  • 46
  • 51
  • 7
    I did not edit the config file directly, but added the key "branch.master.merge" using the Properties dialog shown above. This also worked like a sharm. – Matthias Wuttke Jul 23 '12 at 16:07
57

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

From the Git Repositories tab:

  • expand your local repository
  • right click on Remote
  • click on Create Remote...
  • Remote name = origin
  • next to IRI press the Change button
  • CTRL+SPACE on URI
  • select the remote location
  • press Finish
  • press Save and Push

Again, from the Git Repositories tab:

  • right click on origin
  • select Configure Fetch...
  • on Ref mapping press the Edit (Advanced)...
  • press Add All Branches Spec
  • select the Force Update checkbox
  • press Finish

Again, from the Git Repositories tab:

  • right click on your local repository
  • select Properties
  • press New Entry...
  • enter the following two keys:

(1)

Key = branch.master.remote
Value = origin

(2)

Key = branch.master.merge
Value = refs/heads/master
Marco Lackovic
  • 6,077
  • 7
  • 55
  • 56
47

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

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

Zip184
  • 1,792
  • 2
  • 21
  • 34
  • 14
    I found "Configure Branch..." very hard to find. I managed to find it by going to "Git Repositories" view, expanding branches, local and then right clicking on the branch – Edd May 29 '13 at 10:08
18

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.git should be replaced with your own HTTPS clone URL.

Aaron Klap
  • 243
  • 2
  • 9
chelder
  • 3,819
  • 6
  • 56
  • 90
10

Same problem. Here's how I solved it within 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".

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

I solved this within eclipse (egit) by:

  1. deleting local branch
  2. pull branch from remote repo as new branch.

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"

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

9

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'

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.

blue-sky
  • 51,962
  • 152
  • 427
  • 752
  • works perfectly. Similar solution as for this question http://stackoverflow.com/a/10662106/759452 – Adriano Nov 19 '12 at 18:03
3

About gview's solution:

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:

[branch "master"]

remote = origin

merge = refs/heads/master

mike
  • 1,135
  • 4
  • 22
  • 39
2

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.

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

An alternative for PULL (avoiding above error) is:

  1. FETCH to update your remote branch on your machine
  2. MERGE of your local branch with your remote branch
    (Team -> Merge... -> Remote Tracking -> origin/branch)
Roberto
  • 500
  • 5
  • 9
2

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

piotrek
  • 13,982
  • 13
  • 79
  • 165
  • this did it in eclipse without any of the "configuration file" modifications. Should be the accepted answer, as the question is specific to eclipse. – josephus Feb 20 '15 at 02:18
2

What I found that worked using eclispe (this is certainly not the right way to go about this but it works): push to remote repository, delete local workspace and repository, import from git using the import dialogue. The import wizard takes care of setting everything up for future pulls.

thomas
  • 21
  • 1
1

The simplest solution I've found while using the Eclipse Git plugin is as follows:

  1. Right click the project and select Team > Push Branch
  2. Make sure the box next to "Configure upstream for push and pull" is checked
  3. Click next and complete the push.

After this completes, the branch will now be correctly configured for pull as well.

1

edit the config file in your repository .git folder like this.

replace https://github.com/your/uri to your github repository uri.

good luck.

[core]
    symlinks = false
    repositoryformatversion = 0
    filemode = false
    logallrefupdates = true
[branch "master"]
    remote = origin
    merge = refs/heads/master
[remote "origin"]
    url = https://github.com/your/uri
    fetch = +refs/heads/*:refs/remotes/origin/*

ps: use idea, forget eclipse

TGich
  • 29
  • 2
0

You need to replace your config file with this code.. your config file is located inside 'git' folder in your repository. The 'git' folder is hidden so first you have to show the hidden files. Open the config file and write these codes :-

[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true


hideDotFiles = dotGitOnly
[remote "origin"]
url = 'url to the git repository that you want to pull'
fetch = 

+refs/heads/*:refs/remotes/origin/*
puttykeyfile = 
[branch "master"]
remote = origin
merge = refs/heads/master
[gui]
wmstate = normal


geometry = 887x427+66+66 171 192
viper
  • 714
  • 1
  • 11
  • 26
0

I got the same issue in Eclipse Neon. But none of the solution worked for me. I got the issue when I changed branch of the project and then it threw this error.The solution I tried is:

  1. Go to project/.git/config file.
  2. If rebase = false, remove it.
  3. Refresh your project.
  4. Do git pull or pull from eclipse.
  5. Error resolved.

PS: As it is an old thread, just updating as this might come in for someone else.

AsthaUndefined
  • 1,111
  • 1
  • 11
  • 24
0

While committing, if you encounter this problem. Try this simple approach:

  1. Team-> Push to upstream - A popup opens.
  2. Copy your URI and paste in that popup.

You branch get configured to pull/push. Your code changes will be pushed to repositary.

Thanks