本地項目上傳到github

1、進入項目所在的文件夾

cd /Users/simon/Documents/workspace/wp_201804/elastic-job-springboot-starter


執行:git init

把這個文件夾變成Git可管理的倉庫

結果:

Initialized empty Git repository in /Users/simon/Documents/workspace/wp_201804/elastic-job-springboot-starter/.git/

此時,項目根路徑下,會多出一個.git 隱藏文件夾,它是Git用來跟蹤和管理版本庫的.

執行:git status

可以看見所有文件

.gitignore

.mvn/

mvnw

mvnw.cmd

pom.xml

src/


2、執行:git add .(add 和.之間隔開)

查看狀態:git status

new file:   .gitignore

new file:   .mvn/wrapper/maven-wrapper.jar

new file:   .mvn/wrapper/maven-wrapper.properties

new file:   mvnw

new file:   mvnw.cmd

new file:   pom.xml

new file:   src/main/java/com/foxiaotao/test/elasticjobspringbootstarter/ElasticJobSpringbootStarterApplication.java

new file:   src/main/java/com/foxiaotao/test/elasticjobspringbootstarter/config/MySimpleJob.java

new file:   src/main/java/com/foxiaotao/test/elasticjobspringbootstarter/controller/HomeController.java

new file:   src/main/resources/application.yml

new file:   src/main/resources/home.html

new file:   src/test/java/com/foxiaotao/test/elasticjobspringbootstarter/ElasticJobSpringbootStarterApplicationTests.java


3、提交,執行

git commit -m "add resource to remote repository"

4、在自己github建立一個項目

複製新建git的地址:https://github.com/foxiaotao/elastic-job-springboot.git

5、建立git client 端和githut的ssh

6、把代碼提交到remote ( 注意吧git地址換成你們自己的項目 )

git remote add origin https://github.com/foxiaotao/elastic-job-springboot.git


git push -u origin master


7、推薦使用工具sourceTree
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章