2012-01-08 134 views
1
$git push origin master 
To [email protected]:dimitar9/first_app.git 
! [rejected]  master -> master (non-fast-forward) 
error: failed to push some refs to '[email protected]:%USERNAME/first_app.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. 
+0

謝謝哈馬爾和韋斯,但怎麼能忽略所有的遠程變化?我只是想強制推送我的本地版本。我可以這樣做嗎? – 2012-01-08 04:41:36

+2

你不能。遠程服務器配置爲「僅快進更新」。有兩種方法可以解決這個問題。 (a)做Hammar和Wes提出的建議,或者(b)推到新的分支。 – 2012-01-08 04:54:13

+0

其實,你可以,但你不應該:https://help.github.com/articles/dealing-with-non-fast-forward-errors – 2012-08-21 17:37:41

回答

4

這意味着有在GitHub上有些變化還沒有被合併到當前的分支。要解決此問題,請執行以下錯誤消息:git pull,解決所有衝突,然後再次嘗試推送。

3

你需要做一個git pull第一。

更新與解釋:因爲你沒有最新的代碼,混帳迫使你推更改之前做您身邊的合併。這是爲了防止他人所做的更改失敗。

如果您有任何衝突,你應該檢討他們決定在本地或遠程代碼是否要提交什麼。

相關問題