5

When trying to pull (Team|Pull from the context menu) in a git repository in Eclipse I get Could not get advertised Ref for branch refs/heads/develop error. I guess that's because remote branch named develop was deleted in the meantime. Branch develop is currently checked out.

How to fix this?
Can I configure git and/or Eclipse so that I don't get this error next time some other remote branch gets deleted?

Piotr Dobrogost
  • 41,292
  • 40
  • 236
  • 366

6 Answers6

13

I had the same error, and so I made sure my .git/config file had the following:

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

That made EGit happy.

Jake Toronto
  • 3,524
  • 2
  • 23
  • 27
4

As I mention in "How do you stop tracking a remote branch in git?", you can unset the associated remote tracking branch with:

git config --unset branch.develop.remote
git config --unset branch.develop.merge

It is certainly possible to edit the fetch/push specifications of a branch in EGit (see "Direct Fetch and Push Support "), but I find it so much quicker through the git CLI (command line interface).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

I had this problem when I messed up with branch name - can't pull despite of the fact that the branch was present in origin.

I "solved" it by switching to another branch and then pull.

Line
  • 1,529
  • 3
  • 18
  • 42
1

I solved this issue by

git push --set-upstream origin <branch_name>

Archmede
  • 1,592
  • 2
  • 20
  • 37
1

I got this error after removed the remote branch and pull the corresponding branch on local, so the resolve solution is easy:

  • switch to valid branch then pull
  • or push local branch to remote
  • or set another remote branch for local branch
  • ... any such operations can help
Isa Wang
  • 51
  • 2
0

I had solved by make sure my .git/config file had the following (like @jake-toronto said):

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

And also make sure mybranch appears in:

[remote "origin"]
    url = http://XXXX.git
    fetch = +refs/heads/develop:refs/remotes/origin/develop
    fetch = +refs/heads/master:refs/remotes/origin/master
    fetch = +refs/heads/mybranch:refs/remotes/origin/mybranch
Okumura
  • 1
  • 3