Git 先创建项目后提交到仓库[Note about fast-forwards]
1.初始化:
git init
2.把项目添加到本地仓储:
git add . git commit -am "备注"
3.添加远程地址
git remote add origin https://gitee.com/xxx/xxx.git
4.提交到仓库
git push -u origin master
5.本地分支和远程分支 建立连接
git branch --set-upstream-to=origin/master master
6.因为远程仓库是刚创建的,本地仓库和远程仓库有不同的开始点【没有共同的commit】,需要拉取代码
git pull origin master --allow-unrelated-histories
7.异常就是由【4/5】导致的
$ git push To https://gitee.com/xxx/xxx.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://gitee.com/xxx/xxx.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

浙公网安备 33010602011771号