Git提交报错 ! [rejected] master -> master (fetch first) error: failed to push some refs to

如图:


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

解决方法二:代码合并

1. git pull --rebase origin master
2. git push origin master

如图:


附上某大神原博客地址

Stack Overflow--解决方法

另一大神解决方法


分割线


博主为咯学编程:父母不同意学编程,现已断绝关系;恋人不同意学编程,现已分手;亲戚不同意学编程,现已断绝来往;老板不同意学编程,现已失业三十年。。。。。。如果此博文有帮到你欢迎打赏,金额不限。。。

你可能感兴趣的:(Git提交报错 ! [rejected] master -> master (fetch first) error: failed to push some refs to)