Git上传错误解决方案:Push rejected: Push to origin/master was rejected

时间:2024-03-25 18:07:10

问题描述:

新建一个项目在IDEA中通过Git上传码云出现Push错误:Push rejected: Push to origin/master was rejected

Git上传错误解决方案:Push rejected: Push to origin/master was rejected

试了网上的方法还是不行,出现:unknown option   "allow-unrelated-histories" 提示

Git上传错误解决方案:Push rejected: Push to origin/master was rejected

解决方法:

     第一步:通过git --version 查看git版本,发现git不是最新版本,

Git上传错误解决方案:Push rejected: Push to origin/master was rejected

     第二步:在git官网,下载最新的Git,覆盖安装,一路点默认就可以了

Git上传错误解决方案:Push rejected: Push to origin/master was rejected

     第三步:在Idea中的Terminal中依次输入:

        git pull

       git pull origin master

       git pull origin master --allow-unrelated-histories

Git上传错误解决方案:Push rejected: Push to origin/master was rejected

   第四步:重新push即可,完成

Git上传错误解决方案:Push rejected: Push to origin/master was rejected