問題描述
- 初次原生程式碼上傳到Github的時候,執行git push -u origin master命令報錯。
- 錯誤詳情
! [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檔案等。
解決方法
- 執行git pull --rebase origin master命令
- 然後推送上傳git push -u origin master