2017-06-21 92 views
-2

我試圖推動在GitHub上的本地回購,但git push不工作對我來說以下是錯誤推送操作不工作

git push https://github.com/MandarSant/Mandars_First_Repo.git master 
To https://github.com/MandarSant/Mandars_First_Repo.git 
! [rejected]  master -> master (fetch first) 
error: failed to push some refs to 'https://github.com/MandarSant/Mandars_First_Repo.git' 
hint: Updates were rejected because the remote contains work that you do 
hint: not have locally. This is usually caused by another repository pushing 
hint: to the same ref. You may want to first integrate the remote changes 
hint: (e.g., 'git pull ...') before pushing again. 
hint: See the 'Note about fast-forwards' in 'git push --help' for details. 
+0

因爲它提到你必須首先協調遠程分支和你的本地分支,所以'git pull'然後'git push' – CoryKramer

+1

git pull origin master --rebase – clonq

+1

你甚至讀過錯誤信息嗎? – Antwane

回答

1

所以就像錯誤消息說的那樣,您嘗試推送的回購已被其他人修改。爲了能夠推送到存儲庫,您應該有最新的更改。

所以你要做的是確保你告訴git,你知道其他人做出的改變。做到這一點的方法是做一個git pull。一旦你這樣做,你應該能夠推送到存儲庫。

0

發生了什麼事是別人推來掌握,而你沒有有這些變化從主本地

拉合併他們與你的變化,然後你可以把

0

如果我對每次有人一毛錢沒看過的錯誤信息......

你需要git pull之前git push

+0

但是對於視頻嘖嘖嘖嘖,他並沒有在[Git&GitHub初學者教程#10 - GitHub簡介](https://www.youtube.com/watch?v=fQLK8Ib_SKk&t=397s) –

0

你需要執行git pull命令之前推任何東西到git存儲庫。 如果有時候可能通知您某些文件將被合併覆蓋,那麼您必須存儲您的更改或將這些文件複製到另一個位置,然後必須恢復更改,然後在應用更改之後進行更改。