1、首先就是自己写好的所有的代码,如图
2、上传代码到自己的gitee里面
首先需要创建仓库,起一个名字
然后会出现很多的代码,这个时候就可以去出现很多代码
我不在截图了,下面看下我上传的过程就可以了
[root@hdss7-22 ~]# mkdir test
[root@hdss7-22 ~]# cd test/
[root@hdss7-22 test]# ls
dubbo-demo-web
[root@hdss7-22 test]# git
[root@hdss7-22 test]# git remote add origin ssh://git@gitee.com:yelinxiaosheng/dubbo-demo-web.git
fatal: Not a git repository (or any of the parent directories): .git
[root@hdss7-22 test]# git init
Initialized empty Git repository in /root/test/.git/
[root@hdss7-22 test]# git remote add origin https://gitee.com/yelinxiaosheng/dubbo-demo-web.git
[root@hdss7-22 test]# git add .
[root@hdss7-22 test]# git commit -m 'xczcz'
[master (root-commit) 5c008ba] xczcz
Committer: root <root@hdss7-22.host.com>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
1 file changed, 1 insertion(+)
create mode 160000 dubbo-demo-web
[root@hdss7-22 test]# git config --global user.name "yelinxiaosheng"
[root@hdss7-22 test]# git config --global user.email "609436769@qq.com"
[root@hdss7-22 test]# git push -u origin master
Username for 'https://gitee.com': yelinxiaosheng
Password for 'https://yelinxiaosheng@gitee.com':
To https://gitee.com/yelinxiaosheng/dubbo-demo-web.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://gitee.com/yelinxiaosheng/dubbo-demo-web.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first merge the remote changes (e.g.,
hint: 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
[root@hdss7-22 test]# 这个仓库有毒------就是上面传输的都是失败的
[root@hdss7-22 test]#
[root@hdss7-22 test]# cd ..
[root@hdss7-22 ~]# cd test/
[root@hdss7-22 test]# ls
dubbo-demo-web
[root@hdss7-22 test]# mkdir test
[root@hdss7-22 test]# cd test
[root@hdss7-22 test]# git init
Initialized empty Git repository in /root/test/test/.git/
[root@hdss7-22 test]# touch README.md
[root@hdss7-22 test]# git add README.md
[root@hdss7-22 test]# git commit -m "first commit"
[master (root-commit) 1a5a711] first commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README.md
[root@hdss7-22 test]# git remote add origin https://gitee.com/yelinxiaosheng/test.git
[root@hdss7-22 test]# git push -u origin master
Username for 'https://gitee.com': yelinxiaosheng
Password for 'https://yelinxiaosheng@gitee.com':
Counting objects: 3, done.
Writing objects: 100% (3/3), 214 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.1]
To https://gitee.com/yelinxiaosheng/test.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
[root@hdss7-22 test]# scp -r ../dubbo-demo-web/* ./
[root@hdss7-22 test]# ls
dubbo-api dubbo-client pom.xml README.en.md README.md
[root@hdss7-22 test]# git add .
[root@hdss7-22 test]# git commit -m 'czxcz'
[master af8386e] czxcz
12 files changed, 406 insertions(+)
create mode 100644 README.en.md
create mode 100644 dubbo-api/pom.xml
create mode 100644 dubbo-api/src/main/java/com/od/dubbotest/api/HelloService.java
create mode 100644 dubbo-client/pom.xml
create mode 100644 dubbo-client/src/main/java/application.properties
create mode 100644 dubbo-client/src/main/java/com/od/dubbotest/Application.java
create mode 100644 dubbo-client/src/main/java/com/od/dubbotest/action/BjAction.java
create mode 100644 dubbo-client/src/main/java/com/od/dubbotest/action/HelloAction.java
create mode 100644 dubbo-client/src/main/java/config.properties
create mode 100644 dubbo-client/src/main/java/spring-config.xml
create mode 100644 pom.xml
[root@hdss7-22 test]# git push -u origin master ##下面有数字才说明上传成功了
Username for 'https://gitee.com': yelinxiaosheng
Password for 'https://yelinxiaosheng@gitee.com':
Counting objects: 32, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (19/19), done.
Writing objects: 100% (30/30), 5.84 KiB | 0 bytes/s, done.
Total 30 (delta 3), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.1]
To https://gitee.com/yelinxiaosheng/test.git
1a5a711..af8386e master -> master
Branch master set up to track remote branch master from origin.
这个时候在去浏览器就能看到已经上传成功了
git add . // 暂存所有的更改
git checkout . // 丢弃所有的更改
git status // 查看文件状态
git commit -m “本次要提交的概要信息” // 提交
这里不多写了,去查看一个还不错的博客吧::
https://blog.csdn.net/wulianlang6162/article/details/96745260