見出し画像

error: failed to push some refs to 'github.com:{name}/{repository}.git'

ローカルで編集したディレクトリにて

git pull
git add .
git commit -m "{commit message}"
git push

を行うと

 ! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'github.com:{name}/{repository}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.

というエラーが発生

とりあえず

git merge --allow-unrelated-histories
git add .
git commit -m "{commit message}"
git push

したらpushできた

この記事が気に入ったらサポートをしてみませんか?