安装
Java:
Java Archive Downloads - Java SE 8
Eclipse:
https://www.eclipse.org/downloads
GitHub客户端:
GitHub Desktop | Simple collaboration from your desktop
选择合适的版本,按提示下载并配置环境,注册GitHub账号。
在Eclipse上安装插件EGit
进入到Eclipse界面,点击菜单栏中的Help - Install New Software - Add,填写Name:EGit,Location:EGit Update Site - Use this URL in Eclipse to install EGit and JGit 5.13.0.202109080827-r,连续下一步默认安装,完成后重启Eclipse。
在Eclipse中配置EGit
菜单栏的window中找到preferences目录,Window——Preferences——搜索Configuration——Add Entry,这里的user.name 是你在https://github.com上注册用户名,user.email是你在github上绑定的邮箱。
创建一个Hello World程序
选择File-New-Java Project新建Java项目
输入Project name, 点击Finish,出现提示New module-info.java, 点击 Create
右击新建的这个文包,New->Class,填写 Package 及 Name ,勾选 public static void main(String[] args),Finish
输入System.out.println("hello world");
完成输出hello world的代码编写。
Run - Run As - Java Application 运行程序
创建本地github库并上传文件
打开GitHub的客户端,点击File - New repository,填写库名,点击下方creat repository成功创建
单击项目, Team->Share project
右击项目,Team->commit,点击标志,任意填写一个Commit Message,点击commit
右击项目,Team - Remote - Push
点击Local Folder,选择repository存放地址,next
在Source ref栏点击选择第二个文件,Add Spec - Next - Finish。
提交远程GIT完成,可以在github核对一下代码是否已经提交