2011-08-24 149 views
3

正在使用Aptana Studio 3和Heroku進行RoR網站項目。當我通過GitHub'提交'後將我的網站推送到Heroku時,我不斷收到此錯誤。到處搜索,但無法找到我可以遵循的簡單解決方案。有什麼建議發生了什麼以及如何重新植入?謝謝。GitHub to Heroku提交錯誤

User$ git push heroku master 
To [email protected]:xxxxxx.git 
! [rejected]  master -> master (non-fast forward) 
error: failed to push some refs to '[email protected]:xxxxxx.git' 
To prevent you from losing history, non-fast-forward updates were rejected. 
Merge the remote changes before pushing again. 
See 'non-fast forward' section of 'git push --help' for details. 
User$ 

我想這個建議按照以下從@SkillDrick和得到這個加在最後的錯誤:

User$ git merge heroku/master master 
usage: git merge [options] <remote>... 
or: git merge [options] <msg> HEAD <remote> 

-n     do not show a diffstat at the end of the merge 
--stat    show a diffstat at the end of the merge 
--summary    (synonym to --stat) 
--log     add list of one-line log to merge commit message 
--squash    create a single commit instead of doing a merge 
--commit    perform a commit if the merge succeeds (default) 
--ff     allow fast forward (default) 
-s, --strategy <strategy> 
         merge strategy to use 
-m, --message <message> 
         message to be used for the merge commit (if any) 
-v, --verbose   be more verbose 
-q, --quiet   be more quiet 



user$ git push heroku master 
To [email protected]:worrybin.git 
! [rejected]  master -> master (non-fast forward) 
error: failed to push some refs to '[email protected]:worrybin.git' 
To prevent you from losing history, non-fast-forward updates were rejected. 
Merge the remote changes before pushing again. 
See 'non-fast forward' section of 'git push --help' for details. 
+1

當你做了'git合併heroku/master master'(我的錯誤),它說'使用率'等,這是告訴你,該命令是不正確的,所以它實際上並沒有合併。 – Skilldrick

回答

5

出於某種原因,你的Heroku回購已發散。你可以這樣做:

git fetch heroku 
git merge heroku/master 
git push heroku master 

它將「在再次推送之前合併遠程更改」。在你合併之前,也許可以做git diff heroku/master找出究竟是的不同。

+0

感謝您的建議。試了一下,又得到了同樣的錯誤 - 已經發布了上面的細節。 – ubique

+0

@ubique對不起,我寫錯了。第二個命令應該是'git merge heroku/master'。 – Skilldrick

+0

現在得到這個消息...任何想法? **用戶$ git merge heroku/master ** 錯誤:未經操作的工作樹文件'._。DS_Store'將被合併覆蓋。 致命:樹木合併5a008289e74cc3eb95880b1cf51b532c6aed66b2和6073db0f540dc1960070d996fd93484aab73439b失敗 – ubique

0

做一個git pull然後做git push

+1

** git pull **返回'已經更新'和** git push **返回'一切都是最新的'。有什麼想法嗎? – ubique

0

像manojlds說,你個混蛋第一拉。

其實在做任何事之前,如果您有任何更改,請檢查您的本地回購。

git status 

如果沒有,請執行git pull heroku master。如果有變化,要麼提交或存儲它們(我只是說現在就把它們藏起來)

在你拉(希望沒有任何衝突)之後,做一個git push heroku master,你應該全部設置好。如果您有衝突,請先解決它們,然後按提交。

基本上發生的事情是,你的英庫回購已經偏離你目前的回購。這主要發生在以下場景:

  1. UserA進行更改,推送到heroku和您的github回購。
  2. UserB拉,做出改變,推向heroku repo,忘記推送給github。
  3. UserA從github中拉出並嘗試推向heroku。

在這種情況下,你是userA,這意味着你拉了一些不在heroku中的東西。

6

我有同樣的問題。一個非常簡單的解決辦法是迫使反正推:

混帳推Heroku的主-f

由於剛剛使用的Heroku來部署應用程序(而不是像產地/主源控制),這應該是精細。