git 推送到替代主服务器被拒绝,因为推送的分支提示位于其远程后面

标签 git

我有两个存储库。一份用于制作,一份用于演出。 alt(暂存)有一些文件和外部联系人正在处理它。无法删除。想要将代码从本地(原始产品)推送到暂存(alt)。添加这两个 Remote ,它们看起来像这样:

$ git remote -v
alt     https://github.com/uname/staging.git (fetch)
alt     https://github.com/uname/staging.git (push)
origin  https://bitbucket.com/uname/prod.git (fetch)
origin  https://bitbucket.com/uname/prod.git (push)

尝试推送到暂存:

$ git push staging master
To https://github.com/uname/staging.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/uname/staging.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and 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 origin,以便使用必要的代码更新您当前的分支。解决 merge 冲突后,您将能够继续推送。

关于git 推送到替代主服务器被拒绝,因为推送的分支提示位于其远程后面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53754306/

相关文章:

linux - 在 Shell 脚本中格式化 Diff 输出

node.js - 如何配置git,以便node_modules可以在本地进行版本控制,但在推送时被忽略?

git - 在 macOS 上启动 gitk 会出现错误应用程序未运行

git - 不小心把commit推到了一个不知名的地方

git - 无法使用应用程序密码通过 Visual Studio Code 登录到 Bitbucket Repo

git - 如何让 git status 只显示暂存文件

Git:找到最后一个 SHA merge 到一个分支

git - 推送到远程私有(private)仓库: fatal: repository not found

android - 如何获取此 git 脚本制作的补丁列表?

Git子模块替代品?