问题描述:在git bash中键入 $ git push 远程仓库 master 进行提交的时候出现 如下错误:
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/%7Dgit'
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.
看一些博客说强制提交之类的,但是对于我来说没有帮助
我的解决方案是:
1.先把自己远程仓库的pull拉到本地合并
** git pull 远程仓库 分支名**
2.再次提交就可以
** git push 远程仓库 分支名**
成功