前提・実現したいこと
ポートフォリオを更新しようと思っています。
https://berukokoko.github.io/beru/
githubでプッシュしようと思ったところ、エラーが発生して進めません。
サイトを更新したいのですが、どうすればプッシュできるのでしょうか?
発生している問題・エラーメッセージ
ターミナルで下記のコマンドを打ったところ、下記のエラーが発生しています。
$ git push origin master
To https://github.com/berukokoko/beru.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/berukokoko/beru.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 add . $ git mommit -m "インデックス更新"
②プッシュしました。
$ git push origin master To https://github.com/berukokoko/beru.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/berukokoko/beru.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 pull origin masterをしました。
下記サイトを参考に、pullしました。
https://qiita.com/katsuyuki/items/8e03e5eb4223912a08c5
$ git pull origin master From https://github.com/berukokoko/beru * branch master -> FETCH_HEAD * [new branch] master -> origin/master fatal: refusing to merge unrelated histories
④git merge --allow-unrelated-histories origin/masterをしました。
refusing to merge unrelated historiesが出たため、下記をを参考に
git merge --allow-unrelated-histories origin/masterコマンドを打ちました。
https://qiita.com/takanatsu/items/fc89de9bd11148da1438
$ git merge --allow-unrelated-histories origin/master Auto-merging js/controller.js CONFLICT (add/add): Merge conflict in js/controller.js Auto-merging index.html CONFLICT (add/add): Merge conflict in index.html Auto-merging image/torin.jpg CONFLICT (add/add): Merge conflict in image/torin.jpg Auto-merging css/a.css CONFLICT (add/add): Merge conflict in css/a.css Automatic merge failed; fix conflicts and then commit the result.
⑤git pull origin masterをしました。
$ git pull origin master error: You have not concluded your merge (MERGE_HEAD exists). hint: Please, commit your changes before merging. fatal: Exiting because of unfinished merge.
⑥git push origin masterを再びしてみたところ、変わらなかったです。
$ git push origin master To https://github.com/berukokoko/beru.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/berukokoko/beru.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 statusで確認したところ下のようになっています。
$ git status On branch master You have unmerged paths. (fix conflicts and run "git commit") (use "git merge --abort" to abort the merge) Unmerged paths: (use "git add <file>..." to mark resolution) both added: css/a.css both added: image/torin.jpg both added: index.html both added: js/controller.js
参考にしました。
https://qiita.com/kyoyyy/items/161b6905f45bee2efe21
・git branch で確認したところ * masterになっています。
・gitについてよくわかっていないことだらけなのでご教授願います。
・mergeというのをしなければならないのでしょうか?
・masterとはブランチの名前であることは理解しました。
・originがレポジトリの名前の別名だとは理解しました。
プッシュできない理由に何が考えられますでしょうか?
補足情報(FW/ツールのバージョンなど)
macOS
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/06/04 01:44
2019/06/04 08:55