7

Why if I create a local repository, then create a github repository and then add that as remote, I commit to local and then I push to remote, but I have no ability to pull from remote to local?

If I add remote using git bash all is well remote is properly configured and I can pull, and push and fetch to upstream but if I do it thru the EGIT wizard it never works for local repositories that get pushed and then get fetched and merged... Any clues?

Here is the log post:

eclipse.buildId=I20110613-1736 java.version=1.6.0_26 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, Framework arguments: -product org.eclipse.epp.package.java.product Command-line arguments: -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.java.product

Error Tue Sep 20 10:40:05 BST 2011 The current branch is not configured for pull

org.eclipse.jgit.api.errors.InvalidConfigurationException: No value for key branch.master.merge found in configuration at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:189) at org.eclipse.egit.core.op.PullOperation$1.run(PullOperation.java:82) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2326) at org.eclipse.egit.core.op.PullOperation.execute(PullOperation.java:104) at org.eclipse.egit.ui.internal.pull.PullOperationUI.execute(PullOperationUI.java:115) at org.eclipse.egit.ui.internal.pull.PullOperationUI$1.run(PullOperationUI.java:90) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Astronaut
  • 6,691
  • 18
  • 61
  • 99
  • What does `git remote -v` return? What error message do you receive when you try to "pull from remote to local"? – basicxman Sep 17 '11 at 00:09
  • the same as http://stackoverflow.com/questions/8820668/the-current-branch-is-not-configured-for-pull-no-value-for-key-branch-master-mer – Paul Verest Aug 05 '13 at 09:41

4 Answers4

9

simply add


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

into .git/config to pull from origin/master into master

CBke
  • 106
  • 1
  • 2
  • Also you have to have [remote "origin"] url = https://username@bitbucket.org/username/projectname.git fetch = +refs/heads/*:refs/remotes/bitbucket/* merge = refs/heads/master – Ömer Faruk AK Dec 03 '12 at 22:26
6

You can do this in the "Git Repositories" tab.

Window > Show view > Other... > Git > Git Repositories

Expend your project's repository > Right click on "Remotes" > Create Remote...

antyrat
  • 27,479
  • 9
  • 75
  • 76
Lionel Gaillard
  • 3,023
  • 1
  • 21
  • 20
  • 1
    EGit seems to treat pull & push setting separately. So sometimes after configuring for example push, pull doesn't work. – Paul Verest Aug 05 '13 at 09:46
1

There's a discussion on this providing a proposed solution, and pointing to a bugzilla bug report at http://www.eclipse.org/forums/index.php/m/683377/ .

In short, the issue seems to be that the Egit system does not know which branch on the remote corresponds to the master branch in eclipse, and the solution is adding this info to a config file.

Steve Kroon
  • 373
  • 3
  • 6
0

The change in the config file didnt work in my case.

So I deleted the local project after the initial push and did a pull afterwards. Now everything's fine.

Bruno Eberhard
  • 1,624
  • 16
  • 22