【发布时间】:2019-07-22 12:43:43
【问题描述】:
当我尝试推送到 Bitbucket 时,我不断收到以下错误。我以前工作得很好,但它就停止工作了。
谁能帮我理解这是什么意思以及如何解决它?
Pushing to https://x-token-auth@bitbucket.org/UserName/project-name.git
To https://bitbucket.org/UserName/project-name.git
= [up to date] Redesign -> Redesign
= [up to date] Version4.0 -> Version4.0
= [up to date] version2.0 -> version2.0
= [up to date] version3.0 -> version3.0
= [up to date] version3.2 -> version3.2
= [up to date] version4.1 -> version4.1
= [up to date] version5.0.3+cocoapods-firebase -> version5.0.3+cocoapods-firebase
= [up to date] version5.1 -> version5.1
= [up to date] version5.2 -> version5.2
= [up to date] version5.3 -> version5.3
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://x-token-auth@bitbucket.org/UserName/project-name.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
仅供参考 - 我不确定如何按照错误中的建议使用 git pull。另外,我使用 git-tower 作为我的 git GUI。
【问题讨论】:
-
Updates were rejected because the tip of your current branch is behind hint: its remote counterpart.... 按照错误消息中包含的建议并执行git pull(或者可能是git pull --rebase)。 -
另外,
git merge origin/mater也可以使用,因为 refs 已经更新 -
pull在消息中基本上是fetch+merge。 Git 会阻止您推送到包含比本地更新版本的分支的远程。这将违反所有版本控制方法... -
当您尝试
git pull时会发生以下两种情况之一。如果您的本地更改与上游的更改无关,那么拉取将成功,您的工作目录和阶段基本相同。如果 Git 不能 执行拉取操作,那么您可能会看到一条错误消息,告诉您提交或存储本地工作,因为拉取操作会覆盖该工作。所以,在这种情况下,你必须先 stash 或 commit,然后再 pull。 -
是的,你应该
pull。让我把它写下来作为给你的正式答案。