IDEA使用Git出现push to origin/master was rejected错误解决方案
在IDEA中配置Git的URL,如下图
- 切换到自己项目所在的目录,右键选择GIT BASH Here
- 在terminl窗口中依次输入命令:
- git pull
- git pull origin master
- git pull origin master --allow-unrelated-histories
- 在idea中重新push自己的项目,即可成功push。
输入 git pull origin master后,可以会进入编译文件内容的情况:
Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with ‘#’ will be ignored, and an empty message aborts # the commit.
即:请输入提交消息来解释为什么这种合并是必要的
git 在pull或者合并分支的时候有时会遇到这个界面。可以不管(直接下面3,4步),如果要输入解释的话就需要:
- 按键盘字母 i 进入insert模式
- 修改最上面那行黄色合并信息,可以不修改
- 按键盘左上角"Esc"
- 输入" :wq",冒号+wq,按回车键即可
参考:https://www.cnblogs.com/shyroke/p/9255630.html
https://blog.csdn.net/mus123/article/details/104201106