いつもありがとうございます。
現在 Ruby on Rails チュートリアル(https://railstutorial.jp/)を進めています。
AWSのCloud9を使用しています。
第2章のToyアプリケーションなのですが、
2.1アプリケーションの計画の部分で、
"次に、Bitbucketで [Create] ボタンをクリックして新しいリポジトリを作成します(図 2.1)。続いて、生成したファイルをこの新しいリモートリポジトリにプッシュします。"
$ git remote add origin git@bitbucket.org:<username>/toy_app.git
$ git push -u origin --all
というところで、下のように実行したのですが、
<実行コード>
ec2-user:/environment/toy_app (master) $ git remote add origin git@bitbucket.org:kazukafka/toy_app.git/environment/toy_app (master) $ git push -u origin --all
ec2-user:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
ec2-user:~/environment/toy_app (master) $ git remote add git@bitbucket.org:kazukafka/toy_app.git
usage: git remote add [<options>] <name> <url>
-f, --fetch fetch the remote branches --tags import all tags and associated objects when fetching or do not fetch any tag at all (--no-tags) -t, --track <branch> branch(es) to track -m, --master <branch> master branch --mirror[=<push|fetch>] set up remote as a mirror to push to or fetch from
ec2-user:~/environment/toy_app (master) $
というふうに、"作成したファイルを新しいリモートリポジトリにプッシュ"できないようです。
git remove の後のbitbucketのsshのコピペの仕方が間違っていると考えているのですが、どうでしょうか?
検索して調べたつもりですが、よく理解できずに困惑しています。
ご教授いただけるとありがたいです。
「追記」
その後、sshではなくHTTPSの方を git remote add origin の後にコピペして、実行しました。
その結果下記のようなエラーが出たので、そちらを調査中です。
ec2-user:/environment/toy_app (master) $ git remote add origin https://kazukafka@bitbucket.org/kazukafka/toy_app.git/environment/toy_app (master) $ git push -u origin --all
ec2-user:
Password for 'https://kazukafka@bitbucket.org':
To https://bitbucket.org/kazukafka/toy_app.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://kazukafka@bitbucket.org/kazukafka/toy_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.
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/02/22 02:45
2018/02/22 12:26