Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
646 views
in Technique[技术] by (71.8m points)

eclipse - EGit: cannot push, cannot pull

I'am using EGit and I commited a change to my local git repository.

I'd like to push this change to a remote. When doing that, a dialog screen pops up which shows "rejected-master-master-non-fast-forward". The answer of this linked question states that I have to pull first.

When doing the pull, an EGit exception is thrown:

org.eclipse.jgit.api.errors.TransportException: Nothing to fetch.
    at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:139)
    at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:253)
    at org.eclipse.egit.core.op.PullOperation$1.run(PullOperation.java:97)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
    at org.eclipse.egit.core.op.PullOperation.execute(PullOperation.java:128)
    at org.eclipse.egit.ui.internal.pull.PullOperationUI.execute(PullOperationUI.java:139)
    at org.eclipse.egit.ui.internal.pull.PullOperationUI$1.runInWorkspace(PullOperationUI.java:114)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.eclipse.jgit.errors.TransportException: Nothing to fetch.
    at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1087)
    at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
    ... 8 more

It seems that I'm stuck. Who can help me out?


UPDATE

The .git/config file in my repository contains (remote URL hid):

[core]
  repositoryformatversion = 0
  filemode = true
  bare = false
  logallrefupdates = true
  ignorecase = true
[branch "master"]
  remote = origin
  merge = refs/heads/master
[remote "origin"]
    url = <URL_HIDDEN>

I'm using Eclipse Git Team Provider 3.4.1.201406201815

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The configuration of the repository seems to miss this line in the [remote "origin"] section:

fetch = +refs/heads/*:refs/remotes/origin/*

It tells git to fetch all refs starting with refs/heads/ (all branches) and store them under refs/remotes/origin/ locally. E.g. the refs/heads/master in the remote repository will become refs/remotes/origin/master locally (or origin/master in short).

Can you add that and try if it makes pull work?

Also, it would be very interesting to know in which way you first created/cloned this repository.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...