说明:高版本eclipse开发工具自带Git插件(免安装)
- 查看eclipse是否已安装git插件
window->preferences
查看是否有git配置项;
不存在请安装后操作哦! 上传本地工程
右击”项目名称”->Team->share project… ->select a repository type:Git,如下图所示
创建本地仓库
3.1 Creation of repositories in the Eclipse workspace is not recommended
警告:不建议在Eclipse工作区中创建存储库
3.2 点击create按钮,我们自己创建一个.git文件仓库
3.3 勾选要上传的工程项目如下图
Path winth repository 为仓库内文件,建议创业一个本项目的父级文件,便于后期管理整洁!
点击完成功能按钮,本地仓库创建成功。
3.4 此时回到工程,项目会如下所示,文件前面会出现‘?’字样,代表着要被提交哦
上传工程代码到本地仓库
右键”项目名称”->Team->Commit (Ctrl+#)
说明:Author:用户名 <邮箱>(提交者的用户名和邮箱)
Committer: 用户名 <邮箱>
commmit 完成本地仓库上传操作!上传工程代码到远程github仓库
输入目的地仓库位置Enter the location of the destination repository.
5.1 Location位置
URI:远程仓库路径
Host:github.com:根据自动填入
Repository path:根据uri自动填入
5.2 Connecton连接
Protocal:选择传输协议为https
Port:不用填
5.3 Authenticaton认证
User:远程仓库用户名
Password:远程仓库密码
Store in Secure Store 保存密码
配置push规则
6.1 选择 source ref:refs/heads/master
6.2 点击+Add Spec
6.3 在Specifications for push
勾选Force Update(强制更新到github仓库中)
finish推送结果 push result
登录github查看
恭喜,完成!