报错:failed to push some refs to git
时间:2022-08-27 00:30:00
报错:error: failed to push some refs to 'github.com:hsxisawd/cloudmusic_django.git'
$ git push -u origin master To github.com:hsxisawd/cloudmusic_django.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'github.com:hsxisawd/cloudmusic_django.git' 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.
错误分析:错误的主要原因是github中的README.md文件不在本地代码目录中
解决方式:
代码合并通过以下命令 git pull --rebase origin master
再重新提交推送就可以了
git push -u origin master