【发布时间】:2013-09-11 06:33:39
【问题描述】:
这是场景:
1) 我和我的项目合作伙伴正在使用 github 作为我们的代码仓库一起开发一个 Ruby on Rails 应用程序。
2) 该应用在她的 github 帐户下,她已将我添加为合作者
3) 她部署到 Heroku 并将我也添加为那里的合作者
4) 我在现有应用程序目录中使用了以下命令,目的是将现有 Heroku 远程应用程序作为远程应用程序添加到现有本地应用程序中。正如我之前提到的,我现有的本地应用程序已经有一个远程 github
git remote add heroku git@heroku.com:codefellow.git
5) 我做了一些更改并将它们推送到 github 并且都是最新的
6) 然后我尝试使用以下命令推送到 heroku
git push heroku master
7) 这给了我一个错误,说我的分支的尖端在后面,如下所示,但是当我尝试从 github 拉取时,它说我是最新的,如下所示
➜ code-fellows-alumni git:(master) git push heroku master
To git@heroku.com:codefellow.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@heroku.com:codefellow.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
➜ code-fellows-alumni git:(master) git pull
Already up-to-date.
那么有人知道这里发生了什么吗?如果我在 Github 上是最新的,我的本地分支怎么会与 Heroku 不同步?我的项目合作伙伴是否有可能在没有先将更改推送到 Github 的情况下将更改推送到 Heroku?我查了一下,她没有应用程序的分支。目前我无法与她取得联系,以确定她可能做了什么——我什至不确定是否允许她将更改推送到 Heroku,如果它们还没有被推送到 Github。任何见解将不胜感激。我不想从 Heroku 克隆应用程序,因为我已经将它与 Github 本地同步。我想使用 Github 作为代码存储库,我不愿意从 Heroku 的克隆开始。我已经查看了 Heroku 文档:https://devcenter.heroku.com/articles/git。它只是说要克隆,但出于上述原因,我不想这样做。我按照这个问题的答案 (How to link a folder with an existing Heroku app) 中给出的指示走到了这一步,但似乎有一个缺失的部分,或者我的项目合作伙伴做了一些不寻常的事情。提前感谢您提供的任何有用的想法。
【问题讨论】:
-
执行此操作
git pull heroku master,然后在消除冲突后再次尝试推送 -
谢谢——很高兴知道这个命令。我认为它可能与 push 命令相同,但以前从未这样做过。
标签: ruby-on-rails git heroku github git-remote