Git 状态报告分支是最新的 'origin/master',但 git 推送被拒绝

Git status reports the branch is up-to-date with 'origin/master', but git push rejected

当我输入 git status 时,我得到以下信息:

On branch master 
Your branch is up-to-date with 'origin/master'

但是当我输入 git push 时,我得到了这个:

! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@bitbucket.org:FoxRocks/pams_amo.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 pull 因为我不知道有什么区别。我读到另一个 post 说我应该输入 git fetch origin 然后输入 git diff master origin/master 但这些命令都没有 return 任何东西。我添加了 -v 以为我会得到更多信息,但它没有。

我是否误解了“'origin/master' 的最新信息”是什么意思?

Am I misunderstanding what it means by "up-to-date with 'origin/master'"?

可能是的。 origin/master 在遥控器 origin 上跟踪 master,但它仍然只是本地的,不会自动与遥控器保持同步。因此,您可以使用 origin/master 进行更新,但不能使用远程 origin 上的 master 进行更新。当您尝试推送时,差异就会显示出来。

要同步它们,git fetch。现在 git status 可能会改弦易辙!试试看。