Help us understand the problem. What is going on with this article?

Gitリポジトリのホスト先を移行する方法

More than 5 years have passed since last update.

概要

$ git clone --mirror <SOURCE_REPOSITORY_URL>
$ cd <REPOSITORY>
$ git push --mirror <DESTINATION_REPOSITORY_URL>

方法

1. 移行元のリポジトリをclone

$ git clone 移行元のリポジトリ

2. ブランチをcheckout

$ cd リポジトリ名
$ sh git.sh (※)
$ rm git.sh

※git.shの中身

for i in `git branch -r|grep -v HEAD|grep -v master|sed 's:origin/::g'`
do
        git checkout --track -b $i origin/$i
done
git checkout master

3. 移行元のリモートリポジトリの登録削除+移行先のリモートリポジトリの登録

$ git remote rm origin
$ git remote add origin 移行先のリポジトリ
$ git remote -vで確認

4. push

$ git push --all
$ git push --tags

以上です:)

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away