2011-05-06 125 views
2

每當我嘗試提交更改到我的github回購時,我都會收到此錯誤。無法對github提交更改

To [email protected]:antarr/3skeleton.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:antarr/3skeleton.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.

如果我先做git pull,它會改變我機器上的一些文件。哪種失敗的目的。

回答

7

這聽起來像文件已被提交,並推送到github上的庫,因爲你上次更新。

做一個git pull將拉下這些變化,並將它們與您的更改合併。然後,您可以測試所有內容並確保它仍然有效,然後再進行一次推送。

它不應該覆蓋您所做的並正在嘗試提交的更改。

+0

這很有道理。我更改database.yml不包括我的密碼,當我拉它時,更改我的機器上的密碼。謝謝。 – 2011-05-06 16:41:26