! [rejected] master -> master (fetch first)问题的解决方案

 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'github.com:huoxiaoqiang88/learngit.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.

大致意思如下:

因为远程仓库包含您本地仓库没有的代码或者文件,在git push之前我们首先需要把远程仓库改动与本地仓库进行合并用“git pull,git merge,git fetch”可解决此问题。

解决方案:

根据上面的报错,意思就是说本地的仓库版本与远程的仓库版本不一致导致的,大家可以先git pull同步一下版本,然后再git push。

原创文章,作者:huoxiaoqiang,如若转载,请注明出处:https://www.huoxiaoqiang.com/experience/jingyan/1699.html

发表评论

电子邮件地址不会被公开。 必填项已用*标注