在推送本地上GitHub 跳出以下錯誤
$ git push -u origin master
To https://github.com/abc/docker-git-lab.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/abc/docker-git-lab.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.
原因大概是我在GitHub建repository時,勾了產出README.md,所以Git Hub上產生了 README.md 檔案,但本地沒有
因此可以
1、先將遠端合併回來,再推上去
或
2、強制把本地推上去
合併回來
$ git pull --rebase https://github.com/sloveliu/docker-git-lab.git master
推上去
$ git push -u origin master
(我用上述這兩個指令)
或
$ git pull -f
沒測試