github 问题 - 错误 : failed to push some refs

标签 git git-push git-pull

我正在尝试将我的主分支推送到我的生产分支。

通常,当我在 Ubuntu 计算机上进行更改时,我会通过以下方式推送到 master:

git add .
git commit -m "message"
git push

一切正常。然后我简单地做:

git push origin master:production

一切正常。但现在由于某种原因,当我在终端中执行“git push origin master:生产”时,我收到消息:

To <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="87e0eef3c7e0eef3eff2e5a9e4e8ea" rel="noreferrer noopener nofollow">[email protected]</a>:Username1/myapp.git
 ! [rejected]        master -> production (non-fast-forward)
error: failed to push some refs to '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfb8b6ab9fb8b6abb7aabdf1bcb0b2" rel="noreferrer noopener nofollow">[email protected]</a>:Username1/myapp.git'
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.
mypc@ubuntu:~/myapp$ 

如何解决这个神秘出现的恼人问题?我尝试了“git pull origin master”,正如消息中和我的研究中其他地方所建议的那样,但我在终端中得到的只是“一切都是最新的”,当我再次尝试时,问题再次出现。谢谢。

最佳答案

有人已经致力于生产分支。

正如@user1281385所说,你应该

git pull origin master:product 或更好,然后以其他方式查看生产分支上的更改。

尝试 git help pull 来阅读更多内容。

关于github 问题 - 错误 : failed to push some refs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17741552/

相关文章:

git - 推送分支到 Git

git - 如何禁用 Git 上的公钥权限检查?

git - arc diff 禁用测试计划 'differential.require-test-plan-field' 不起作用

javascript - 如何使用提交版本更新本地路径?

git - 使用push.default电流推送时如何自动设置上游?

git - `git push` -- 没有输出,没有任何反应

git - 解决 git pull 中的 merge 冲突?

git - 如何使用不同的 pathdef 同时运行两个 MATLAB 实例?

git - 如何使用 git-ftp 将特定分支推送到 ftp 服务器

git - 如何调试 "git pull"花费太多时间?