集成Eclipse和GitHub

时间:2014-01-31 05:47:20

标签: eclipse github

我需要帮助尝试设置Eclipse,以便我可以将我的代码推送到我的GitHub帐户。我在网上搜索过,我发现的教程要么已经过时,要么对我不起作用。

我已经在Eclipse上有一个项目。我如何将该代码放到GitHub上?请有人请详细说明。任何帮助表示赞赏。

修改 我一发布这个问题,摆弄设置,我就设法让它发挥作用!多么巧合......

我现在唯一的问题是如何设置它以便在我提交时只选择项目文件夹中的文件?现在它在Package Explorer中显示所有600个文件。

enter image description here

1 个答案:

答案 0 :(得分:32)

好的,有几种方法可以做到这一点。我发现这是最简单的方法:

首先,设置SSH2配置。转到Windows - > Preferences - > General - > Network Connections - > SSH2 - > Key Management和{{ 1}}。 Generate RSA Key

复制该密钥。您需要转到GitHub帐户设置并将新的SSH密钥添加到您的帐户。

现在,您需要安装eGit:

enter image description here

enter image description here

接下来,您要添加Git存储库视图:

enter image description here

enter image description here

enter image description here

创建一个新的Git存储库。我已经创建了一个名为Save Key的存储库。我将在其余的解释中提到该回购。

enter image description here

创建存储库后,它应显示在Git存储库视图中。现在将项目添加到存储库,右键单击您的项目并选择Team-> Share Project。

选择刚刚创建的存储库。您还可以使用CTRL +选择多个项目并将它们放在一个存储库中。

现在回到你的Git Repositories视图。转到遥控器。右键单击并选择Create Remote。

enter image description here

选择Java并在GitHub上输入存储库的SSH链接。 要进行连接,请选择SSH。然后按完成。 enter image description here 对于Rev-mapping,请选择Change...。 对于Advanced...,请选择Source Ref。然后按refs/heads/master,然后选择Add Spec小组Save specifications in 'origin' configuration. Then press finish. That's pretty much it. You can commit changes by right clicking your project - >提交...

enter image description here

将新提交推送到GitHub:

enter image description here

这是关于如何设置Eclipse拉取请求的非常好的解释。

The current branch is not configured for pull No value for key branch.master.merge found in configuration

相关问题