完整的错误提示如下
To gitee.com:chenhuijiang/AutoTest.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:chenhuijiang/AutoTest.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.
根据错误提示 用git pull 将远程仓库的内容pull下来
无奈pull下来后再push还是报上述错误
网上查找资料 找到了下面的解决办法
在当前本地仓库下用git bash输入下面命令
git pull origin master --allow-unrelated-histories
此时会有一个弹窗,提示你修改一个文档的内容,不用管他,按ESC键
再按SHIFT+; (SHIFT+;用来输入一个冒号) 再输入wq保存
:wq
接下来把远程仓库再pull一次
看到这个提示表明pull完成
再试试用
git push origin master
出现上面提示表示push到远程仓库成功