質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

1回答

263閲覧

rails-tutorial 3章 git pushがrejectされるのでご指導頂きたいです。

退会済みユーザー

退会済みユーザー

総合スコア0

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2018/08/17 00:12

編集2022/01/12 10:55

3章のセットアップの指示通りに実行していましたが、pushするタイミングでエラーとなります。
1-2章ではなんとか上手くできたのですが、出来た理由がよくわかってないので、3章での解決方法がわかりません。。。
すみませんが、ご指導お願いします。

https://railstutorial.jp/chapters/static_pages?version=5.1#cha-static_pages

ec2-user:/environment/sample_app (master) $ git init
Reinitialized existing Git repository in /home/ec2-user/environment/sample_app/.git/
ec2-user:
/environment/sample_app (master) $ git add -A
ec2-user:/environment/sample_app (master) $ git commit -m "Initialize repository"
[master (root-commit) 3d28315] Initialize repository
76 files changed, 1201 insertions(+)
ec2-user:
/environment/sample_app (master) $ git commit -am "Improve the README"[master 86d8004] Improve the README
1 file changed, 41 insertions(+), 24 deletions(-)
rewrite README.md (97%)
ec2-user:/environment/sample_app (master) $ git remote add origin git@bitbucket.org:kotoneko/sample_app.git
ec2-user:
/environment/sample_app (master) $ git push -u origin --all
To bitbucket.org:kotoneko/sample_app.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@bitbucket.org:kotoneko/sample_app.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.

ググって色々試しましたが、ダメでした。。。
https://qiita.com/takanatsu/items/fc89de9bd11148da1438

ec2-user:~/environment/sample_app (master) $ git fetch
warning: no common commits
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From bitbucket.org:kotoneko/sample_app

  • [new branch] master -> origin/master

ec2-user:/environment/sample_app (master) $ git merge origin/master
fatal: refusing to merge unrelated histories
ec2-user:
/environment/sample_app (master) $ git push -u origin master
To bitbucket.org:kotoneko/sample_app.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@bitbucket.org:kotoneko/sample_app.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.
ec2-user:/environment/sample_app (master) $ git --version
git version 2.14.4
ec2-user:
/environment/sample_app (master) $ git fetch && git merge origin/master
fatal: refusing to merge unrelated histories
ec2-user:/environment/sample_app (master) $ git merge --allow-unrelated-histories origin/master
Auto-merging README.md
CONFLICT (add/add): Merge conflict in README.md
Automatic merge failed; fix conflicts and then commit the result.
ec2-user:
/environment/sample_app (master|MERGING) $

あと、(master|MERGING)を(master)にするにはどうすればいいのでしょうか??

よろしくお願いします。。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

CONFLICT (add/add): Merge conflict in README.md

これが原因です。

Automatic merge failed; fix conflicts and then commit the result.

これの後半が解決方法です。

投稿2018/08/17 03:17

退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問