windows下新增项目本地通过git bash推送至远程github

北战南征 提交于 2019-11-28 08:11:05

  本地E盘workspace目录下新增了spring-cloud-alibaba-demo项目,还没有编译过,没有target等不需要推送至git的文件,所以就直接用git bash丢到github了。先在github上创建一个空项目,跟本地目录同名:

 

  然后就纯命令行操作了,打开git bash:

wulf@wulf00 MINGW64 /c/Users
$ cd e:

wulf@wulf00 MINGW64 /e
$ cd workspace/spring-cloud-alibaba-demo/

wulf@wulf00 MINGW64 /e/workspace/spring-cloud-alibaba-demo
$ git init
Initialized empty Git repository in E:/workspace/spring-cloud-alibaba-demo/.git/

wulf@wulf00 MINGW64 /e/workspace/spring-cloud-alibaba-demo (master)
$ git remote add origin https://github.com/wuxun1997/spring-cloud-alibaba-demo.git

wulf@wulf00 MINGW64 /e/workspace/spring-cloud-alibaba-demo (master)
$ git add .
warning: LF will be replaced by CRLF in pom.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in spring-cloud-alibaba-consumer/pom.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in spring-cloud-alibaba-consumer/src/main/resources/application.properties.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in spring-cloud-alibaba-gateway/pom.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in spring-cloud-alibaba-provider/pom.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in spring-cloud-alibaba-provider/src/main/java/com/wlf/alibaba/provider/TransProviderApplication.java.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in spring-cloud-alibaba-provider/src/main/resources/application.properties.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in spring-cloud-alibaba-provider/src/test/java/com/lingxicloud/lxytrans/provider/TransProviderApplicationTests.java.
The file will have its original line endings in your working directory.

wulf@wulf00 MINGW64 /e/workspace/spring-cloud-alibaba-demo (master)
$ git commit -m "first commit"
[master (root-commit) e75e0ee] first commit
 13 files changed, 525 insertions(+)
 create mode 100644 pom.xml
 create mode 100644 spring-cloud-alibaba-consumer/pom.xml
 create mode 100644 spring-cloud-alibaba-consumer/src/main/java/com/wlf/alibaba/consumer/TransConsumerApplication.java
 create mode 100644 spring-cloud-alibaba-consumer/src/main/resources/application.properties
 create mode 100644 spring-cloud-alibaba-gateway/pom.xml
 create mode 100644 spring-cloud-alibaba-gateway/src/main/java/com/wlf/alibaba/gate/GatewayConfiguration.java
 create mode 100644 spring-cloud-alibaba-gateway/src/main/java/com/wlf/alibaba/gate/TransGatewayApplication.java
 create mode 100644 spring-cloud-alibaba-gateway/src/main/resources/application.yml
 create mode 100644 spring-cloud-alibaba-provider/pom.xml
 create mode 100644 spring-cloud-alibaba-provider/src/main/java/com/wlf/alibaba/provider/TestService.java
 create mode 100644 spring-cloud-alibaba-provider/src/main/java/com/wlf/alibaba/provider/TransProviderApplication.java
 create mode 100644 spring-cloud-alibaba-provider/src/main/resources/application.properties
 create mode 100644 spring-cloud-alibaba-provider/src/test/java/com/lingxicloud/lxytrans/provider/TransProviderApplicationTests.java

wulf@wulf00 MINGW64 /e/workspace/spring-cloud-alibaba-demo (master)
$ git push -u origin master
Logon failed, use ctrl+c to cancel basic credential prompt.
Username for 'https://github.com': wuxun1997
Counting objects: 48, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (28/28), done.
Writing objects: 100% (48/48), 5.81 KiB | 424.00 KiB/s, done.
Total 48 (delta 6), reused 0 (delta 0)
remote: Resolving deltas: 100% (6/6), done.
To https://github.com/wuxun1997/spring-cloud-alibaba-demo.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

wulf@wulf00 MINGW64 /e/workspace/spring-cloud-alibaba-demo (master)
$

  最后我们看到代码已经提交到git了:

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!