gitlab正常提交:
# 1st step:
$ git init
Initialized empty Git repository in E:/GitWsp/hello/.git/
#2nd step:
$ git remote add origin https://gitlab.xxx.com/test/hello.git
#3rd step:
$ git add .
# 4th step:
$ git commit -m "Initial Version"
# check status [optional]
$ git status
On branch master
# check branch [optional]
$ git branch
* master
#check config [unnassesary]
$ git config --list
....
remote.origin.url=https://gitlab.xxx.com/test/hello.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
# 5th step:
$ git push --set-upstream origin master
Counting objects: 782, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (741/741), done.
Writing objects: 100% (782/782), 533.90 KiB | 0 bytes/s, done.
Total 782 (delta 211), reused 0 (delta 0)
remote: Resolving deltas: 100% (211/211), done.
To https://gitlab.xxx.com/test/hello.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
https 提交去掉验证
# 走过的坑 - https ssl 验证
$ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
$ git push --set-upstream origin master
fatal: unable to access 'https://gitlib.xxx.com/test/hello.git/': SSL certificate problem: unable to get local issuer certificate
# 解决办法 - 忽略 SSL 验证
$ git config --global http.sslVerify false
git 拉取代码:
# git 拉取代码后提交
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
WMZ@▒▒▒▒▒▒ MINGW64 /e/GitWsp/test/hello (master)
$ git branch --set-upstream-to=origin/master master
Branch master set up to track remote branch master from origin.
无法推送-1:
$ git pull
fatal: refusing to merge unrelated histories
$ git pull origin master --allow-unrelated-histories
git rm -r --cached .
git push -u origin master -f //强制提交