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
588 views
in Technique[技术] by (71.8m points)

github - Eclipse/Egit, Push to Remote menu choice is grayed out

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?

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

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.


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

...