git push报错! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://gitee.com/XXX.git
git pull origin master --allow-unrelated-histories //把远程仓库和本地同步,消除差异
git add .
git commit -m"XXX"
git push origin master
上述有时候可能不能彻底解决问题 因为这里边可能存在 你提交的 和 服务器上的 是两个项目
需要:
git pull origin master --allow-unrelated-histories
这条命令允许了不同项目的合并
然后接下来
git push origin master
上传成功。