プログラミング勉強日記
2021年3月18日
エラー内容
GitHubにpushしようとしたときに以下のエラーが出た。
$ git push origin ブランチ名
To https:///githubのURL
[rejected]develop -> develop (non-fast-forward)error: failed to push some refs to 'https://githubのURL'
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.
原因
調べてみると、コミットする前にREADMEの変更を行っていたのが原因だった。前に一度リモートにpushした整合性がとれずにずれているのが原因みたいだった。
解決方法
$ git fetch
$ git merge origin/master
参考文献
【git】error: failed to push some refs to "URL"のエラー対処法
git push 時の error: failed to push some refs to