git更新远程仓库报错

时间:2023-03-09 01:56:35
git更新远程仓库报错
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

关于这个报错我试了网上很多方法都没有解决,最后使用下面这个博客解决了我的问题
博客地址:https://blog.****.net/xiaoduan_/article/details/80904888

其实问题出现的原因很简单,主要就是我们在本地没有README.md这个文件,但是我们在船舰仓库的时候我们又选择了生成这个文件。

解决方法一
直接使用命令git pull --rebase origin master
再使用git push –u origin master
解决方法二:
就是我们在新建一个项目的时候,默认不生成README.md文件

自己踩过的坑,希望对你们有帮助!