題名の通り、
クローンしたリポジトリ[ローカル]を別リポジトリ[リモート]にpushするやり方を知ったので
アウトプットしていこうと思います。
流れ[図]
■クローン
$ git clone -b main https://github.com/kazuya424/testproject.git test
■作成したtestフォルダに移動
$ cd test
■remote urlの確認
$ git config remote.origin.url
https://github.com/kazuya424/testproject.git
■remote urlの変更
$ git remote set-url origin https://github.com/kazuya424/test.git
■再度remote urlの確認
$ git config remote.origin.url
https://github.com/kazuya424/test.git
■ブランチ作成
$ git branch -M main
■ブランチ確認
$ git branch
* main
■push
$ git push -u origin main
Username for ユーザーネーム入力
Password for パスワード入力
Counting objects: 3, done.
Writing objects: 100% (3/3), 243 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/kazuya424/test.git
* [new branch] main -> main
Branch main set up to track remote branch main from origin.
追加(testリポジトリ[ローカル]を変更し、pushまで)
今回用いるエディタはVSCode。
上記で作成したtestフォルダを開く。
VSCodeで「新しいターミナル 」を開く。
push先がtestリポジトリか確認し、異なる場合は変更。
$ git config remote.origin.url
https://github.com/kazuya424/testproject.git
$ git remote set-url origin https://github.com/kazuya424/test.git
$ git config remote.origin.url
https://github.com/kazuya424/test.git
■ブランチ作成
$ git branch develop
■developブランチに移動
$ git checkout develop
■ブランチ確認
$ git branch
■内容変更
あとはお決まりのプッシュまでの流れ
$ git status
$ git add.
$ git commit -m “コミット名”
$ git push origin develop