Git/github/他gitからgithubへ移動
提供: 初心者エンジニアの簡易メモ
準備
Git LFS のインストール(macであれば)
brew install git-lfs
lfsを初めて使うリポジトリで必須
git lfs install
他gitからgithubへ移動の手順
bitbucketからの例
- bitbucketからcloneされたレポジトリのdirを、backupしておく
- bitbucketのレポジトリのbranchを、それぞれpullして最新へ
- bitbucketのremoteのurlを削除する
git remote rm origin
- githubのremoteのurlを追加する
git remote add origin git@github.com:user1/project1.unity.git
- github側へ各branchをpush
git内の大きいファイル履歴をlfs化か削除
# リポジトリサイズ確認 git count-objects -vH # 再度大きなファイルを検出(削除を確認) git rev-list --objects --all | \ git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | \ awk '/^blob/ {print substr($0,6)}' | \ sort --numeric-sort --key=2 | \ tail -n 10 # まだあるファイルの場合は該当ファイルを LFS に移行 git lfs migrate import --include="Assets/Firebase/Plugins/x86_64/FirebaseCppApp-11_8_0.bundle" # もう無いファイルは、大きいファイルのgit履歴を削除(物理ファイルが削除されることがあるので気をつける) git filter-repo --force --invert-paths --path docs/hogehoge.key