git のコードを保存したいので
(master) $ git remote add origin git@bitbucket.org:username/second_repo.git
とすると
git
1 $ git push 2Warning: Permanently added 'bitbucket.org,104.192.143.1' (RSA) to the list of known hosts. 3 4To bitbucket.org:user/first_repo.git 5 ! [rejected] master -> master (non-fast-forward) 6 7error: failed to push some refs to 'git@bitbucket.org:user/first_repo.git' 8hint: Updates were rejected because the tip of your current branch is behind 9hint: its remote counterpart. Integrate the remote changes (e.g. 10hint: 'git pull ...') before pushing again. 11hint: See the 'Note about fast-forwards' in 'git push --help' for details.
とでたので指示どおりすると
toy_app (master) $ git pull origin master Warning: Permanently added 'bitbucket.org,104.192.143.1' (RSA) to the list of known hosts. From bitbucket.org:user/first_repo * branch master -> FETCH_HEAD fatal: refusing to merge unrelated histories
というエラーがでました。たしかに first_repo とうのに入っているコードといま入れたいコードは全くべつものだということを思い出したので新しくbitbucket でsecond_repo
というのをつくり、ためしましたがエラーがでました。
git
1 (master) $ git remote add origin git@bitbucket.org:user/second_repo.git 2 3fatal: remote origin already exists.
origin というのは2回使えないというので second_origin
として試しました。
(master) $ git remote add secondorigin git@bitbucket.org:user/second_repo.git
エラーがでなかったのでもう一度 git push したらはじめと同じエラーがでました。
git
1 $ git push 2Warning: Permanently added 'bitbucket.org,104.192.143.1' (RSA) to the list of known hosts. 3 4To bitbucket.org:user/first_repo.git 5 ! [rejected] master -> master (non-fast-forward) 6 7error: failed to push some refs to 'git@bitbucket.org:user/first_repo.git' 8hint: Updates were rejected because the tip of your current branch is behind 9hint: its remote counterpart. Integrate the remote changes (e.g. 10hint: 'git pull ...') before pushing again. 11hint: See the 'Note about fast-forwards' in 'git push --help' for details.
とにかくぼくはコードの保存がしたいです。元の first_repo がきえても構いません。どうしたらいいのでしょうか教えてください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/04/09 04:25
2017/04/10 02:18
2017/04/10 07:04