2013-07-02 21 views
1

所以我在一個項目上合作,克隆了github的回購,做了一些改變,並推到了heroku。現在克隆的應用程序的所有密鑰和密碼都是硬編碼的,而不是ENV變量。不能推主分支到heroku

所以我創建了ENV變量,將該文件添加到.gitignore。所以這個應用程序在提交歷史中仍然有這些鍵。我現在所做的是讓作者在github上創建一個新的repo,從原始應用程序中刪除.git文件並將新代碼推送到新的repo。

所以現在我已經克隆了新的應用程序,添加了一個新的遠程heroku應用程序。

heroku git:remote -a myapplication 

我的問題是我不能推新應用程序到現有的heroku應用程序。當我做我得到

error: failed to push some refs to '[email protected]:myapplication.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. 

所以一個git拉說,一切都是最新的。

遠程Git -v輸出

heroku [email protected]:myapplication.git (fetch) 
heroku [email protected]:myapplication.git (push) 
origin [email protected]:author/myapplication.git (fetch) 
origin [email protected]:author/myapplication.git (push) 

我能做些什麼來推動新的應用到現有的Heroku應用程序?

感謝

UPDATE

於是我就

git push -f heroku master 

從而拉高,但我有錯誤

you have not declared a Ruby version in your Gemfile. 
    To set your Ruby version add this line to your Gemfile:" 
    ruby '1.9.2'" 

香港專業教育學院從未有過的指定之前。現在所有的原始配置變量,其中設置不再存儲在heroku

回答

3

git pull將默認從GitHub,其中已經提交所有提交。

您可能需要:

  • git pull heroku
  • 清理文件通過heroku命令(如果合併帶回硬編碼值)
  • origin
  • heroku
+0

謝謝你的回答,你介意看我的更新,並告知我是否仍然可以做同樣的事情嗎? – Richlewis

+0

@Richlewis我不會將力量直接推向heroku:首先拉動的所有點都是讓推動更容易(沒有任何強制選項)。通過heroku命令推動heroku應該發生,而不是直接通過git。如果你有權訪問heroku服務器,你可以嘗試重置到git repo以前的狀態(如http://stackoverflow.com/a/135614/6309) – VonC

+0

好了,所以我回滾了,應用程序很好,im擔心從heroku拉,因爲它仍然有原始的代碼庫,那裏是一個很多變化的地獄,這將導致重大沖突 – Richlewis

1

Git使用跟蹤分支的概念來知道哪個遠程分支鏈接到本地​​分支。

在你的情況,你可能有你的本地分支(我想這是master)鏈接到origin/master。所以,當你做git pull時,Git試圖從[email protected]:author/myapplication.git獲得新的東西,這不是想要的行爲。

你必須使用更改跟蹤分支:

  • git branch --set-upstream-to heroku/my_branch

然後,你可以做一個git pull現在將有希望的行爲。然後像往常一樣推動heroku。

+0

嗯可能已經跳過槍,你可以看看我的更新,並建議如果我現在卡在沒有男人的土地,謝謝 – Richlewis

+0

嗯,我主要回答你的Git問題。我不知道Heroku有足夠的解決方案來提交,對不起。祝你好運 :) –