0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

リモートリポジトリを複数設定したい

Last updated at Posted at 2021-09-09

リモートリポジトリを複数設定する要件があったので、調べた結果を自分用に記録します。

現在のリポジトリを確認

git remote -v
origin	git@github.com:foobar/hoge-app.git (fetch)
origin	git@github.com:foobar/hoge-app.git (push)

ここで出力されるのが、現在登録されているリポジトリです。
2つで1セットですね。

追加

どこでもいいので、新たにリモートリポジトリを作成し、以下を実行。
今回はgithubで作成しました。

git remote add hugahuga git@github.com:foobar/hoge-app2.git

hugahugaの部分は自分で好きなわかりやすい名前をつけます。

確認

最初に実行したコマンドで設定が出来ているか確認します。

git remote -v
origin	git@github.com:foobar/hoge-app.git (fetch)
origin	git@github.com:foobar/hoge-app.git (push)
hugahuga	git@github.com:foobar/hoge-app2.git (fetch)
hugahuga	git@github.com:foobar/hoge-app2.git (push)

増えていれば成功です。

扱い方

それぞれのリポジトリに違うタイミングで別々にpushすることが出来ます。

git push origin main
git push hugahuga main 

参考記事

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?