本地已经有项目代码了在add和commit之后,想要push到远程仓库
git push origin master
此时报错
$ git push origin master
To `xxx.git`
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'xxx.git'
1、git pull origin master --allow-unrelated-histories //把远程仓库和本地同步,消除差异
2、重新add和commit相应文件
3、git push origin master
4、此时就能够上传成功了