一、Eclipse上安装GIT插件EGit
Eclipse的版本eclipse-java-helios-SR2-win32.zip(在Eclipse3.3版本找不到对应的 EGit插件,无法安装)


EGit插件地址:http://download.eclipse.org/egit/updates
OK,随后连续下一步默认安装就可以,安装后进行重启Eclipse
二、在Eclipse中配置EGit
准备工作:需要在https://github.com 上注册账号
Preferences > Team > Git > Configuration

这里的user.name 是你在https://github.com上注册用户名

user.email是你在github上绑定的邮箱。在这里配置user.name即可
三、新建项目,并将代码提交到本地的GIT仓库中
1、新建项目 git_demo,并新建HelloWorld.java类

2、将git_demo项目提交到本地仓库,如下图



到此步,就成功创建GIT仓库。但文件夹处于untracked状态(文件夹中的符号”?”表示),下面我们需要提交代码到本地仓库,如下图



OK,这样代码提交到了本地仓库
四:将本地代码提交到远程的GIT仓库中
准备工作:在https://github.com上创建仓库


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

准备工作做好了,那开始将代码提交到远程仓库吧






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

注意的问题
如果是首次提交会第一步:先在本地建立一个一样的仓库,称本地仓库。
第二步:在本地进行commit操作将把更新提交到本地仓库;
第三步: 将服务器端的更新pull到本地仓库进行合并,最后将合并好的本地仓库push到服务器端,这样就进行了一次远程提交。
如果非首次提交同样的道理
第一步:将修改的代码commit操作更新到本地仓库;
第二步:第三步: 将服务器端的更新pull到本地仓库进行合并,最后将合并好的本地仓库push到服务器端