一、前言
上一个章节,我们通过Eclipse的EGit插件将代码提交到了本地仓库。但是我们现在想要将本地代码也要推送到Github上面,该怎么操作呢?前面学习Git时候,《Git教程之如何添加远程仓库这一章节已经告诉我们怎么将本地仓库和远程GitHub仓库联系起来了,但是这种方式是通过Git命令的方式实现的,现在我们想通过Eclipse可视化操作的方式实现,该如何操作呢?
二、案例
在https://github.com上创建仓库

点击“Create repository” ,OK,这样在github上的仓库就创建好了。
注意创建好远程仓库后,点击进去,此时可以看到一个HTTPS地址,如红线框,这个是你https协议的远程仓库地址

♦准备工作做完了,开始将代码提交到远程仓库
右键工程 ->Team ->Remote ->Push…

弹出界面,如下:

点击Next

点击Add Spec

点击Next

点击Finish,弹出界面

在这个过程中,会出现如下提示:

这时候选择No
OK,这样提交远程GIT就完成了,可以在https://github.com核对一下代码是否已经提交

如上图,已经提交成功,远端可以看到提交的代码。
原文地址:http://www.marsitman.com/eclipse/eclipse-git-syn-github.html
网友评论