[英]Why I cannot push my code to github?
$git push origin master
To git@github.com:dimitar9/first_app.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:%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.
這意味着GitHub上的某些更改尚未合並到您當前的分支中。 要解決此問題,請執行錯誤消息告訴您的操作: git pull
,解決所有沖突,然后嘗試再次推送。
您需要先執行git pull
。
更新說明 :由於您沒有最新的代碼,因此git會強制您先進行合並,然后再進行更改。 這是為了防止丟失其他人所做的更改。
如果有任何沖突,應檢查它們,以決定要提交的是本地代碼還是遠程代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.