初次Push程式碼到Github報錯

而知無涯發表於2018-03-06

問題描述

  1. 初次原生程式碼上傳到Github的時候,執行git push -u origin master命令報錯。
  2. 錯誤詳情
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/TTmrxb/TTPlayer.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
複製程式碼

問題原因

Github遠端分支有檔案沒有合併到本地,如README檔案等。

解決方法

  1. 執行git pull --rebase origin master命令
  2. 然後推送上傳git push -u origin master

相關文章