#前提
現在Ruby on rails TutorialにてRailsを学習中の初学者です。
文中指定の通りAWSを用いて学習を開始したのですが、項番1.4.3にて詰まっております。
#問題
問題が発生している箇所はリスト1.11の部分です。
bash
1$ git remote add origin git@bitbucket.org:[UserName]/hello_app.git 2$ git push -u origin --all
1行目は無事行うことができるのですが、2行目にて以下のログが表示されます。
bash
1$ git push -u origin --all 2Warning: Permanently added the RSA host key for IP address '18.205.93.1' to the list of known hosts. 3Enter passphrase for key '/home/ec2-user/.ssh/id_rsa': 4invalid command syntax. 5fatal: Could not read from remote repository. 6 7Please make sure you have the correct access rights 8and the repository exists.
致命的なエラーとして、リポジトリが読み取れませんと表示されてしまいます。
#試したこと
こちらのサイトを参考に、リモートの再登録を行おうとすると、以下のログが出力されました。
bash
1$ git remote add origin git@bitbucket.org:[UserName]/hello_app.git 2fatal: remote origin already exists.
既にリモートが存在するということでしたので、こちらのサイトを参考に一度リモートを削除し、改めてリモートの登録を行いそのままプッシュしたところ、次に以下のログが出力されました。
bash
1$ git push origin 2fatal: The current branch master has no upstream branch. 3To push the current branch and set the remote as upstream, use 4 5 git push --set-upstream origin master
致命的なエラー解消のために指定されたコマンドを入力したのですが、以下のログが出力されました。
bash
1$ git push --set-upstream origin master 2Enter passphrase for key '/home/ec2-user/.ssh/id_rsa': 3To bitbucket.org:uguni123/hello_app.git 4 ! [rejected] master -> master (fetch first) 5error: failed to push some refs to 'git@bitbucket.org:[UserName]/hello_app.git' 6hint: Updates were rejected because the remote contains work that you do 7hint: not have locally. This is usually caused by another repository pushing 8hint: to the same ref. You may want to first integrate the remote changes 9hint: (e.g., 'git pull ...') before pushing again. 10hint: See the 'Note about fast-forwards' in 'git push --help' for details.
ヒントとこちらのサイトを参考に、以下の4つを試してみました。
対応方法 1) とりあえず git pull する
...
対応方法 2)fetch して merge する
...
対応方法 3)fetch して rebase する
...
対応方法 4)pull –commit や pull –rebase する
...
全て試してみたのですが、問題解決には至ることができませんでした。
GitHubの記事は多く散見するのですが、Bitbucketについての記事は相対的に数が少なく、自分の検索力不足からTeratailさんに質問させていただくことに致しました。
皆さんの知恵をお借りさせていただければ幸いです。
よろしくお願いします。
#環境
Windows 10 64bit
Firefox Quantam 62.0.3
Git 2.14.4
Amazon Linux AMI release 2018.3
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。