Q&A
前提・実現したいこと
ローカルで作業が進んだので、リモートリポジトリのchoブランチにgit pushしたいのですが、git push origin master:choでやろうとしたら以下のようなエラーが出てgit pushできませんでした。
! [rejected] master -> cho (non-fast-forward)
error: failed to push some refs to 'https://github.com/aaa'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and 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.
git pullすると良いと聞いたのでgit pull origin masterは問題なく実行できました。
- branch master -> FETCH_HEAD
Already up to date.
そこで再びgit push origin master:choを実行してみたのですが、同じエラーメッセージが出てきて失敗してしまいます。
どうすればgit pushできるでしょうか?
発生している問題・エラーメッセージ
> To https://github.com/aaa ! [rejected] master -> cho (non-fast-forward) error: failed to push some refs to 'https://github.com/aaa' hint: Updates were rejected because a pushed branch tip is behind its remote hint: counterpart. Check out this branch and 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.
補足情報(FW/ツールのバージョンなど)
ちなみにローカルのgitの環境はこんな感じです。
% git remote -v
origin https://github.com/aaa (fetch)
origin https://github.com/aaa (push)
% git branch
cho
*master
% git status
On branch master
Your branch is ahead of 'origin/master' by 3 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
回答1件
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
2020/12/26 09:25