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

人盡茶涼 提交于 2019-11-28 03:50:16

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.

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.

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.

Line

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 :)

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.

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!