LoginSignup
4
4

More than 5 years have passed since last update.

Gitリポジトリ移行のメモ

Posted at

Gitリポジトリ移行でちょっとハマったのでメモ書き。

既存のGitリポジトリのホストを変える方法を探していたら、下記コマンドでタグとかブランチごとまるっとできるよっていう記事がいくつか見つかったのだけど、エラーになったり、そもそもどこで作業してるの??とかよく分からなかった・・。

git clone --mirror <REPOSITORY_URL>
cd <REPOSITORY>
git push --mirror <NEW_REPOSITORY_URL>

エラー内容

No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
Everything up-to-date

いろいろやってみたところ、clone --mirror でできるディレクトリはバックアップファイルだということ。
このバックアップファイルの中に、push したいデータがまとめて入っていた。
あーそうか、cd \<REPOSITORY>ってそういうことだったのね・・。

ということで、まとめると以下。

1.作業したいディレクトリを作成し、そこに移動する
2.git clone --mirror http://xxxx.xxxx.xx.xx/testgroup/test_repository.gitを実行し、リポジトリをブランチもタグも含めまるっとバックアップファイルを作成
3.test_repository.git というバックアップファイルができるので、cd test_repository.gitで一階層下がる
4.git push --mirror http://++++.++.++/testgroup/test_repository.gitを実行し、バックアップファイルを新しいホストに push する

これで完了!

4
4
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
4
4