git 远程与本地不一致导致的报错
报错信息:
error:failed to push some refs to …
Dealing with “non-fast-forward” errors
From time to time you may encounter this error while pushing:
$ git push origin master
To ../remote/! [rejected] master -> master (non-fast forward)
error: failed to push some refs to ‘../remote/‘
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the ‘non-fast forward’
section of ‘git push –help’ for details.
原因
是因为远程与本地不一致导致的
解决步骤:
- 需要先拉取远程的
- 再手动合并冲突文件
- 提交修改
- 提交到远程
1 | $git pull origin |
参考资料:
Comments