报错:failed to push some refs to git

出现的报错: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 

你可能感兴趣的:(git报错解决方法合集,python,git,github)