git push送信で一部の参照をプッシュできませんでした

問題の説明

$ git push -u origin master

error: failed to push some refs to 'codechina.csdn.net:BAR_WORKSHOP/topopt-in-matlab.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のREADME.mdファイルがローカルディレクトリにありません。

解決

git pull --rebase origin master

上記のコマンドを最初に実行すると、ローカルディレクトリにREADME.mdファイルがさらにあることがわかり、プッシュは失敗しません。

git push -u origin master

おすすめ

転載: blog.csdn.net/BAR_WORKSHOP/article/details/108582506