正文
windows下新增项目本地通过git bash推送至远程github
小程序:扫一扫查出行
【扫一扫了解最新限行尾号】
复制小程序
【扫一扫了解最新限行尾号】
复制小程序
本地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了:
另外通过IDEA推送的方式参见IDEA新建本地项目关联远程git仓库。