导读:上一篇讲解了从idea整合github帐号,这张来讲解一下从idea新建个springboot项目后,如何上传到github上面
idea新建springboot项目
点击next
继续next
继续finish
等待下载jar包
第一次下载挺长时间的,建议选择的springboot不要用最新版本,不然加载的会很慢,如果网络好可以忽略这个建议,这里我用了2.0.5.RELEASE
这里统一把application.properties改成application.yml(springboot官网推荐)
application.yml
server:
port: 8887
servlet:
context-path: /hello
spring:
application:
name: hello
编写HelloController
HelloController.java
package com.example.demo.hello;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@GetMapping("/hello")
public String hello(){
return "hello,world,how are you?";
}
}
启动项目
用浏览器访问项目接口
将项目添加git版本控制
创建本地git仓库,选中demo路径
这里变成红色了
对着项目右键添加进git
提交目录
如果git没写名称及邮箱,第一次会要求填写
提交成功了
将本地仓库推送至github仓库
点击share进行推送
提交上去了,可从github上面看到
添加接口提交:
github有提交记录了
总结
过程并不复杂,新建springboot项目,然后创建本地git仓库,最后推送到自己绑定的github中,在这个过程中,令我最头疼的是访问github很慢,推送github经常连接超时,下一篇来讲解一下从github中拿取旧项目下载到本地,然后用idea打开项目,更改项目的代码,上传到github上面。
参考链接:
https://www.cnblogs.com/jinjiyese153/p/6796668.html