LoginSignup
124

More than 5 years have passed since last update.

リモートリポジトリを他のものに移行する方法

Posted at

GithubからBitbucketに移行したいような場合や、
GitLabからGithubに移行したいような場合、リモートリポジトリを付け替える必要がある。

心配事としては、Gitのログをちゃんと引き継げるかどうか心配になるけど、リモートリポジトリを付け替えを行えば大丈夫
手順はこんな感じだ

移行先のリモートリポジトリを作成する

ローカルのリポジトリを現在のリポジトリの最新状態を取得する

> git fetch

現在のリモートリポジトリの接続情報を確認する

> git remote -v

リモートリポジトリ(origin)を削除する

> git remote remove origin

新しいリポジトリ(同じくoriginで命名する)を追加する

> git remote add origin https://user@bitbucket.org/user/reponame.git

ローカルリポジトリを空のリモートリポジトリに追加する

> git push origin master

Pushにけっこう時間がかかってればだいたい成功してると思ってよい。
最後に移行先サービスでコミットログを確認し移行していることが確認したら終わり

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
124