- Published on
github创建readme后push报错的解决方法
- Authors
- Name
- Lif
在github新建库的时候,如果新建readme并且进行编辑,再将本地git库push会报错,提示:
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
这时候可以通过强行push
git push -f -u origin master
或者按照说明,先进行git pull,然而git pull又会报错。。。。
fatal: refusing to merge unrelated histories
可以使用
git pull origin master --allow-unrelated-histories
之后再进行push。