解决报错! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@

在执行命令 git push origin master 时,报错 ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to '[email protected]:***‘
  • 使用Git上传项目到 码云gitee
git add .
git status
git commit -m "提交"
git push origin master

查了许多文档,意思是远程仓库的README.md 与本地没有合并。(建仓库的时候勾选了创建 README.md)

  • 可以使用以下命令进行合并:
git pull -rebase origin master
  • 如果还是不成功可以试着清空仓库

  • 再次执行 push 命令,成功

Enumerating objects: 36, done.
Counting objects: 100% (36/36), done.
Delta compression using up to 8 threads
Compressing objects: 100% (29/29), done.
Writing objects: 100% (36/36), 112.31 KiB | 7.49 MiB/s, done.
Total 36 (delta 5), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-3.8]
To gitee.com:suespring/element-base.git
 * [new branch]      master -> master

你可能感兴趣的:(解决报错! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@)