コミット履歴がある場合、以下のエラーが発生する場合があります。
! [rejected] master -> master (fetch first)
error: failed to push some refs to '(リポジトリのURL)'
移行元のGitリポジトリをクローンします。
git clone (GitリポジトリのURL)
または
git clone --mirror (GitリポジトリのURL)
元のGitリポジトリのリモート情報を削除します。次のコマンドを実行します。
git remote remove origin
次のコマンドを実行して新しいGitリポジトリの情報を追加します。
git remote add origin (GitリポジトリのURL)
または、
git remote add origin https://username@github.com/yourname/reponame.git
git remote add origin username@github.com:yourname/your-repo.git
次のコマンドを実行してプッシュします。先に設定した新しいGitリポジトリに対してプッシュされます。
git push --all origin
git push --tags origin
! [rejected] master -> master (fetch first)
error: failed to push some refs to '(リポジトリのURL)'