我读过了一些关于破坏的git推送的解释,但是他们都没有涉及这种情况。没有冲突的git推送失败
我无法将我的本地更改推送到远程存储库,即使拉出后也没有冲突。
$ git pull
Already up-to-date
$ git st
# On branch unstable
nothing to commit (working directory clean)
$ git push
To ssh://<url>
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'ssh://<url>'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
<url>
当然是我的存储库的真实URL。
没有变化拉,没有冲突,我不知道还有什么可能导致此失败。
我相信我已经把一切都设置正确:
$ git remote -v
origin ssh://<url> (fetch)
origin ssh://<url> (push)
$ git branch -v
master 175a09d [behind 18] openReview must now be called from thread other than main.
* unstable c9e5cab Progress on attachments.
在过去,我刚刚删除了我的本地仓库。但是,这种情况更频繁。
- 是什么导致了这种情况发生?
- 我怎样才能避免它在未来?
- 我该如何解决这个问题?
此答案正确。另见:http://stackoverflow.com/a/8301464/156060 –
你说得对。问题是主分支,我没有意识到我必须先抽出。此外,这是否意味着'git pull --all'是'git push'的真正对应物? –