上传代码前新建好group及repository(需要有权限的账号操作)
进入要上传的文件夹中,先初始化本地分支,然后add远程分支,有冲突则要pull远程代码并合并,最后push本地分支到远程分支
PS D:\code\system-refactor\system-service> git add .
fatal: not a git repository (or any of the parent directories): .git
PS D:\code\system-refactor\system-service> git init
Initialized empty Git repository in D:/code/system-refactor/system-service/.git/
PS D:\code\system-refactor\system-service> git add .
warning: LF will be replaced by CRLF in gradle/wrapper/gradle-wrapper.properties.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in gradlew.
The file will have its original line endings in your working directory
PS D:\code\system-refactor\system-service> git commit -m "初始化代码"
[master (root-commit) cba6c44] 初始化代码
140 files changed, 6633 insertions(+)
create mode 100644 .gradle/5.6.4/executionHistory/executionHistory.bin
。。。。。。。
PS D:\code\system-refactor\system-service> git remote add origin https://gitlab.liangmixian.me/system-refactor/system-service.git
PS D:\code\system-refactor\system-service> git pull origin master
From https://gitlab.liangmixian.me/system-refactor/system-service
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
fatal: refusing to merge unrelated histories
PS D:\code\system-refactor\system-service> git pull origin master --allow-unrelated-histories
From https://gitlab.liangmixian.me/system-refactor/system-service
* branch master -> FETCH_HEAD
Merge made by the 'recursive' strategy.
README.md | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 README.md
PS D:\code\system-refactor\system-service> git push -u origin master
Enumerating objects: 208, done.
Counting objects: 100% (208/208), done.
Delta compression using up to 4 threads
Compressing objects: 100% (167/167), done.
Writing objects: 100% (207/207), 1.97 MiB | 2.99 MiB/s, done.
Total 207 (delta 17), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (17/17), done.
To https://gitlab.liangmixian.me/system-refactor/system-service.git
ec5f959..9a5b797 master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.