29

I created a repository on GitHub. I set up a local git repository using Eclipse and Egit. With Team > Remote > Push. I managed to push the local repo to the one on GitHub.

Now I expected to be able to use the Team > Push to Upstream (as well as fetch from upstream) as a one-click push (and pull/fetch), but this menu choice is not available (grayed out). I have to use Team > Remote > Push to each time manually fill in the info (ctrl+space helps).

Following this, I created a remote configuration and pushed from the repositories view, and I can see the remote GitHub repository listed under Remotes but still the Team > Push to Upstream command is grayed out in the menu.

Could someone please give me a hint as to what I have may done wrong?

1
  • To fix this problem follow the steps reported in this other answer link Mar 7, 2013 at 17:20

6 Answers 6

45

Here's what I did and this worked fine:

  1. Right click your project, choose Team→Show in Repositories View. You will switch perspectives and be in the Git Repositories tab.
  2. Right-click "Remotes" and choose "Create Remote". For "Remote name", enter "origin". Click OK.
  3. Click Change. Enter your information as you did during your initial push. Click Save.

You should now be able to push by merely right-clicking on your project, then Team→Push to Upstream.

Because the remote was added under the project in question, each project can have its own upstream origin and they will not interfere (whereas the Window > Preferences solution is a global setting).

Based on your description of what you did, it appears you attempted this - but possibly did not use the name "origin" for the remote, which is absolutely necessary. I stumbled across this solution by pure chance.

3
  • 4
    this also works to setup for Pulling! just choose "Configure fetch" after step 2, then click "ok", then go to step 3.
    – Adriano
    Nov 19, 2012 at 18:00
  • 1
    Thank you Derrick for saving me from this headache! :) Worked perfectly!
    – Vincy
    Oct 8, 2013 at 10:51
  • 1
    This solution is the equivalent to how most "Team -> Share Project..." flows work with other source controls. It would be nice if EGit allowed you to share to a remote repository upon sharing the project, but it is instead a two step process - 1. Share project and create a new local repository, 2. configure the remote for the local repository. I guess that is just how Git works. Jul 6, 2015 at 21:19
15

I had this problem and thankfully found a way to re-enable the "Push to Upstream" option.

  1. Go to Window > Preferences > Team > Git > Configuration.
  2. Select the Repository Settings tab and then the repository that represents your project.
  3. Click "New Entry..."
  4. The key is remote.origin.url
  5. The value is the url you copy from github. It's usually offered predominantly on whichever site you register with.

Perhaps there is a neater way of achieving the same thing. Once I reached this far I stopped looking because it works now.

2
  • Thanks Clockwork! This worked perfectly for me! Didn't even have to bounce Eclipse. OP should approve this answer. :/
    – PaulG
    Jun 24, 2012 at 23:11
  • Derrick's answer (posted later than this one) is a quicker way. Oct 24, 2012 at 10:19
4

You need to have the following type of configuration in that repository's .git/config file:

[branch "master"]
    remote = origin

The remote setting can be any of your remotes or just a value of .

You can edit the repository's config by selecting the Properties menu item from the context menu for the repository in the Git Repositories view.

1
  • OK, thanks. Probably I don't get what you mean with what the "remote setting can be". I tried all stuff I could think of, including a dot, as you suggest, but to no avail. Whatever project I put under git versioning, Eclipse never gives me the Team > Fetch from Upstream or Push to Upstream commands. I guess Eclipse+Git is not for me. So much fiddling... Jan 18, 2012 at 20:24
1

I came here searching for solution to solve similar problem with bitbucket - although none of the two highest votes answer didn't work for me, it proved that I had option "Put branch...", when I tried to do this, it says "Non fast-forward", but when I successfully made "pull", I was able to push to upstream.

Maybe it will help someone :)

0

This post might be a little old, but I had the same issue with one of my repos the following information from this link worked for me: Adding a remote to an existing git repo

The part i want to highlight from that article is the following:

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

When I made the change in the .git/config and refreshed eclipse the "push to upstream" link worked for me. Keep in mind, I am assuming that you have a remote configured in your Git perspective for your remote repository.

0

In my case all git commit/push operations are inactive. I fixed the issue by placing the repository folder under git directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.