Github:non-fast-forwardエラーの対処法
解決済
回答 1
投稿
- 評価
- クリップ 0
- VIEW 2,180
git pushを行いたいと思っています。
ですが、現状、git push時に以下のエラーが出ます。
vagrant@ubuntu-xenial:~/workspace/twitter$ git push git@github.com: name/Twitter.git master
To git@github.com:Momoko-Takita/Twitter.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com: name /Twitter.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が必要だと考えたのでgit pullしたら以下のエラーが出ました
agrant@ubuntu-xenial:~/workspace/twitter$ git pull git@github.com: name /Twitter.git master
warning: no common commits
remote: Enumerating objects: 96, done.
remote: Counting objects: 100% (96/96), done.
remote: Compressing objects: 100% (81/81), done.
remote: Total 96 (delta 2), reused 96 (delta 2), pack-reused 0
Unpacking objects: 100% (96/96), done.
From github.com: name /Twitter
* branch master -> FETCH_HEAD
Auto-merging package.json
CONFLICT (add/add): Merge conflict in package.json
Auto-merging db/schema.rb
CONFLICT (add/add): Merge conflict in db/schema.rb
Auto-merging config/secrets.yml
CONFLICT (add/add): Merge conflict in config/secrets.yml
Auto-merging config/routes.rb
CONFLICT (add/add): Merge conflict in config/routes.rb
Auto-merging config/environments/production.rb
CONFLICT (add/add): Merge conflict in config/environments/production.rb
Auto-merging config/database.yml
CONFLICT (add/add): Merge conflict in config/database.yml
Auto-merging config/cable.yml
CONFLICT (add/add): Merge conflict in config/cable.yml
Auto-merging config/application.rb
CONFLICT (add/add): Merge conflict in config/application.rb
Auto-merging bin/rake
CONFLICT (add/add): Merge conflict in bin/rake
Auto-merging bin/rails
CONFLICT (add/add): Merge conflict in bin/rails
Auto-merging app/views/layouts/application.html.erb
CONFLICT (add/add): Merge conflict in app/views/layouts/application.html.erb
Auto-merging app/assets/javascripts/application.js
CONFLICT (add/add): Merge conflict in app/assets/javascripts/application.js
Auto-merging README.md
CONFLICT (add/add): Merge conflict in README.md
Auto-merging Gemfile.lock
CONFLICT (add/add): Merge conflict in Gemfile.lock
Auto-merging Gemfile
CONFLICT (add/add): Merge conflict in Gemfile
Auto-merging .gitignore
CONFLICT (add/add): Merge conflict in .gitignore
Automatic merge failed; fix conflicts and then commit the result.
・このエラーが出たのでmergeする必要があると考えたので
vagrant@ubuntu-xenial:~/workspace/twitter$ git push git@github.com:name/Twitter.git
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream git@github.com:name/Twitter.git master
あとはエラーに対処していっただけです、、、
vagrant@ubuntu-xenial:~/workspace/twitter$ git push git@github.com:name/Twitter.gitmaster
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream git@github.com:name/Twitter.gitmaster master
vagrant@ubuntu-xenial:~/workspace/twitter$ git push --set-upstream git@github.com:name/Twitter.gitmaster master
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
ブランチはMasterブランチしかありません。
今はgit pull を行っても以下のエラーが起きるようになりました。
fatal: This operation must be run in a work tree
お尋ねしたいこと
git push ができない原因はmergeができていないことが原因だと考えてるのですが、
なかなかマージがうまくいきません。
マージの仕方が悪いのでしょうか?
また、うまくいっていない理由は他にあるのでしょうか?
よろしくお願いいたします。
-
気になる質問をクリップする
クリップした質問は、後からいつでもマイページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
クリップを取り消します
-
良い質問の評価を上げる
以下のような質問は評価を上げましょう
- 質問内容が明確
- 自分も答えを知りたい
- 質問者以外のユーザにも役立つ
評価が高い質問は、TOPページの「注目」タブのフィードに表示されやすくなります。
質問の評価を上げたことを取り消します
-
評価を下げられる数の上限に達しました
評価を下げることができません
- 1日5回まで評価を下げられます
- 1日に1ユーザに対して2回まで評価を下げられます
質問の評価を下げる
teratailでは下記のような質問を「具体的に困っていることがない質問」、「サイトポリシーに違反する質問」と定義し、推奨していません。
- プログラミングに関係のない質問
- やってほしいことだけを記載した丸投げの質問
- 問題・課題が含まれていない質問
- 意図的に内容が抹消された質問
- 過去に投稿した質問と同じ内容の質問
- 広告と受け取られるような投稿
評価が下がると、TOPページの「アクティブ」「注目」タブのフィードに表示されにくくなります。
質問の評価を下げたことを取り消します
この機能は開放されていません
評価を下げる条件を満たしてません
質問の評価を下げる機能の利用条件
この機能を利用するためには、以下の事項を行う必要があります。
- 質問回答など一定の行動
-
メールアドレスの認証
メールアドレスの認証
-
質問評価に関するヘルプページの閲覧
質問評価に関するヘルプページの閲覧
checkベストアンサー
+1
このエラーが出たのでmergeする必要があると考えたので
そのとおりです
git push git@github.com:name/Twitter.git
言っていることとやっていることが違う
最初のエラーをよく見ましょう
Automatic merge failed; fix conflicts and then commit the result.
ここに書かれていることがあなたのするべき全てです。
投稿
-
回答の評価を上げる
以下のような回答は評価を上げましょう
- 正しい回答
- わかりやすい回答
- ためになる回答
評価が高い回答ほどページの上位に表示されます。
-
回答の評価を下げる
下記のような回答は推奨されていません。
- 間違っている回答
- 質問の回答になっていない投稿
- スパムや攻撃的な表現を用いた投稿
評価を下げる際はその理由を明確に伝え、適切な回答に修正してもらいましょう。
15分調べてもわからないことは、teratailで質問しよう!
- ただいまの回答率 88.22%
- 質問をまとめることで、思考を整理して素早く解決
- テンプレート機能で、簡単に質問をまとめられる
2019/01/03 08:46
参考にさせていただきました。
ありがとうございます。