LoginSignup
6
6

More than 5 years have passed since last update.

GitLabからGitHubへの引越し手順

Last updated at Posted at 2015-09-18

GitLabからGithubへのブランチの引越しをやったので手順をメモしておきます。
作業内容としては、GitLabからソースをチェックアウトして、そのままGitHubにPushしただけです。

1)移行したいリポジトリをClone

git clone <URL>
git checkout <BRANCH>

2)リモートリポジトリを変更("git remote -v"で状態確認)

git remote -v
git remote remove origin
git remote -v
git remote add origin <URL>
git remote -v

3)Push

git push origin <NEW_BRANCH>

これで完了です。簡単 :hatching_chick:

※ただし大きいファイルがあるとNG(下記の手順を実施する必要があります)

◆上述の手順3)を実施後、下記のようなエラーが出た場合は追加手順が必要です。

this is larger than GitHub's recommended maximum file size of 50.00 MB
this exceeds GitHub's file size limit of 100.00 MB

GitHubには単一ファイルは100Mまでしか扱えないという制限があるようなので、
そういった場合には下記の手順が追加で必要になります。

https://help.github.com/articles/working-with-large-files/
※参考

1)BFG Repo-Cleanerをダウンロード

BFG Repo-Cleaner というrepositoryを一括できれいにする為のツールがあるので、
http://rtyley.github.io/bfg-repo-cleaner/
の右からjarをダウンロード。 ※今回は「bfg-1.12.5.jar」を使いました。

2)実行

# java -jar bfg-1.12.5.jar --strip-blobs-bigger-than 50M

→こんなメッセージが出ます。
BFG run is complete! When ready, run: git reflog expire --expire=now --all && git gc --prune=now --aggressive

3)下記を実行しろと言われているので実行

git reflog expire --expire=now --all
git gc --prune=now --aggressive

4)Push

git push origin <NEW_BRANCH>

これで完了 :chicken:

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