2012-05-25 18 views
27

我收到以下錯誤。我該如何解決?: git add。 git的承諾-M 'T' 混帳推起源發展GitHub - 錯誤:未能推動一些裁判'[email protected]:myrepo.git'

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

回答

58

你的出身庫是提前本地倉庫。在推送之前,您需要按照以下步驟從源存儲庫中獲取更改。這可以在您的提交和推送之間執行。

git pull origin development 

development指的是你想從中拉出的分支。 如果你想從master分支拉,然後輸入這一個。

git pull origin master 
+8

上述消息中的'development'指的是你想要從中拉出的分支。所以如果你使用'master'分支,你可以輸入:'git pull origin master' – Myna

+0

這工作完美謝謝! –

4

您可以在控制檯寫:

git pull origin 

然後按TAB,寫你的 「主」 庫

1

在Windows中,則需要用雙引號 「」。於是命令將

git的承諾-m「T」

1

在我的情況git push努力推動更多的只是當前分支,因此,我得到這個錯誤,因爲其他部門同步沒有。

要解決您可以使用:git config --global push.default simple 這將使git只推送當前分支。

這隻適用於更新版本的git。即:不會在1.7.9.5上工作

-1
$ git fetch --unshallow origin 
$ git push you remote name 
相關問題