題目の通りです。
git
1git add . 2git status 3git commit -m "resize font" 4git remote add origin http://github.com/zizynonno/railsweb.git
の順でgithubにプッシュをしようと思っているのですが、fatal: remote origin already exists.
というエラーを吐かれ、その後git push -u origin master
してユーザー名とパスワードを入力しようとしてもGitHub側で変更が反映されないケースがチラホラ見当たるので、根本的な原因解明をしたいと考えております。
##こちらで類推していること&わからないこと
・fatal: remote origin already exists.
は「すでに(同じファイルが)リモートに存在している」という意味に類推できる。そうなると、下記行動ログのコピペでいうgit commit -m "resize font"
にて1 file changed, 1 insertion(+), 1 deletion(-)
で変更履歴が出ているので、リモートに存在しているファイルは新しいファイルのはず。新しいファイルであれば、「すでに(同じファイルが)リモートに存在している」という意味合いを持つfatal: remote origin already exists.
というエラーメッセージはどういう意図で吐かれているのか?
・拙いプログラミング経験の中で(1年未満)、1回目のgithubへのプッシュと2回目のgithubへのプッシュでなんとなく行動が違うように思えます(1回目と同じやり方で2回目プッシュしようとするとうまくいかない)。2回目以降うまくいくケースといかないケースがあるが、これは一体どういうことなのか?GitHub側で変更が反映されないのはなぜなのか?
この2点についてお答えいただければと思います。
以下行動ログのコピペです。
##コピペ
git
1ec2-user:~/environment/railsweb (official_sites) $ git add . 2ec2-user:~/environment/railsweb (official_sites) $ git status 3On branch official_sites 4Changes to be committed: 5 (use "git reset HEAD <file>..." to unstage) 6 7 modified: app/views/tops/portfolio.html.erb 8 9ec2-user:~/environment/railsweb (official_sites) $ git commit -m "resize font" 10[official_sites 704a] resize font 11 Committer: EC2 Default User <ec2> 12Your name and email address were configured automatically based 13on your username and hostname. Please check that they are accurate. 14You can suppress this message by setting them explicitly: 15 16 git config --global user.name "Your Name" 17 git config --global user.email you@example.com 18 19After doing this, you may fix the identity used for this commit with: 20 21 git commit --amend --reset-author 22 23 1 file changed, 1 insertion(+), 1 deletion(-) 24ec2-user:~/environment/railsweb (official_sites) $ git remote add origin http://github.com/zizynonno/railsweb.git 25fatal: remote origin already exists. 26ec2-user:~/environment/railsweb (official_sites) $

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/08/03 07:24
2018/08/03 07:30
2018/08/03 07:52 編集
2018/08/03 07:57 編集
2018/08/03 07:52
2018/08/03 07:59
2018/08/03 08:10 編集