Eclipse/Egit,推送到远程菜单选项呈灰色

发布于 2024-12-25 05:52:19 字数 491 浏览 2 评论 0原文

我在 GitHub 上创建了一个存储库。我使用 Eclipse 和 Egit 设置了本地 git 存储库。 与团队>远程>推。我设法将本地存储库推送到 GitHub 上的存储库。

现在我希望能够使用 Team >作为一键推送(和拉取/获取)推送到上游(以及从上游获取),但此菜单选项不可用(灰显)。我必须使用 Team >远程>每次手动填写信息时按下ctrl+空格帮助)。

接下来,我创建了一个远程配置并从存储库视图中推送,我可以看到 < 下列出的远程 GitHub 存储库code>Remotes 但仍然是Team >推送到上游命令在菜单中呈灰色显示。

有人可以给我一个提示,告诉我我可能做错了什么吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

冬天旳寂寞 2025-01-01 05:52:19

这就是我所做的,效果很好:

  1. 右键单击您的项目,选择“团队”→“在存储库视图中显示”。您将切换视角并进入“Git 存储库”选项卡。
  2. 右键单击“远程”并选择“创建远程”。对于“远程名称”,输入“来源”。单击“确定”。
  3. 单击“更改”。输入您的信息,就像您在初次推送时所做的那样。单击“保存”。

现在,您应该只需右键单击您的项目,然后选择“团队”→“推送到上游”即可进行推送。

因为远程是在相关项目下添加的,所以每个项目都可以有自己的上游源,并且它们不会干扰(而“窗口”>“首选项”解决方案是全局设置)。

根据您对所做操作的描述,您似乎尝试了此操作 - 但可能没有使用遥控器的名称“origin”,这是绝对必要的。我偶然发现这个解决方案纯属偶然。

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.

非要怀念 2025-01-01 05:52:19

我遇到了这个问题,幸运的是找到了一种重新启用“推送到上游”选项的方法。

  1. 转到窗口 >首选项>团队> git >配置。
  2. 选择“存储库设置”选项卡,然后选择代表您的项目的存储库。
  3. 点击“New Entry...
  4. 键是remote.origin.url
  5. 值是你从github复制的url。它通常主要在您注册的网站上提供。

也许有一种更巧妙的方法可以实现同样的目标。一旦我到达这里,我就停止寻找,因为它现在可以工作了。

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.

花落人断肠 2025-01-01 05:52:19

您需要在该存储库的 .git/config 文件中进行以下类型的配置:

[branch "master"]
    remote = origin

remote 设置可以是您的任何遥控器,也可以只是 的值。

您可以通过从 Git 存储库 视图中存储库的上下文菜单中选择属性 菜单项来编辑存储库的配置。

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.

肥爪爪 2025-01-01 05:52:19

我来这里寻找解决方案来解决与 bitbucket 类似的问题 - 尽管两个最高票数的答案都不适合我,但它证明我有选项“放置分支...”,当我尝试这样做时,它说“非快进”,但是当我成功进行“拉”时,我能够推到上游。

也许它会对某人有所帮助:)

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

熊抱啵儿 2025-01-01 05:52:19

这篇文章可能有点旧,但我的一个存储库也有同样的问题,此链接中的以下信息对我有用:向现有 git 存储库添加远程

我想从该文章中强调的部分如下:

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

当我在 .git/config 中进行更改时,刷新了日食“推到上游”链接对我有用。请记住,我假设您在 Git 透视图中为远程存储库配置了远程。

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.

情场扛把子 2025-01-01 05:52:19

就我而言,所有 git commit/push 操作均处于非活动状态。我通过将存储库文件夹放在 git 目录下解决了这个问题。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文