Push rejected: Push to origin/master was rejected

1、错误日志

23:04    Maven projects need to be imported: Import Changes   Enable Auto-Import

23:05    4 files committed: 初始化项目

23:06    Push rejected: Push to origin/master was rejected

23:07    2 files committed: 初始化项目

23:07    Push rejected: Push to origin/master was rejected

2、解决方案

1.切换到自己项目所在的目录,右键选择GIT BASH Here


2.在terminl窗口中依次输入命令:

git pull

git pull origin master

git pull origin master --allow-unrelated-histories

3.在idea中重新push自己的项目,成功!!!

附一张执行的图:

 

转载地址:https://www.jianshu.com/p/b0fca181fbf7

原文地址:https://www.cnblogs.com/niceyoo/p/10056219.html