티스토리 뷰

Git

Gitlab -> Github 100mb 이상 migration

Young_J 2021. 3. 31. 12:47

1. Git lfs와 BFG Repo Cleaner를 설치

rtyley.github.io/bfg-repo-cleaner/

 

BFG Repo-Cleaner by rtyley

$ bfg --strip-blobs-bigger-than 100M --replace-text banned.txt repo.git an alternative to git-filter-branch The BFG is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history: Removing Crazy Big Files Re

rtyley.github.io

 

2. 복사하고자 하는 저장소(GitLab)의 clone을 생성

git clone --mirror https://gitlab.com/user_id/old-repo.git

 

3. 커밋 히스토리 내에서 Large file를 찾아 tracking

git filter-branch --tree-filter 'git lfs track "*.{zip,jar}"' -- --all

 

4. BFG를 이용하여 해당 파일들을 Git lfs로 변경

java -jar ~/bfg-repo-cleaner/bfg-1.13.0.jar --convert-to-git-lfs '*.zip'

java -jar ~/usr/bfg-repo-cleaner/bfg-1.13.0.jar --convert-to-git-lfs '*.jar'

 

5. 새로운 저장소(GitHub)로 mirror-push를 진행

cd old-repository.gitgit push --mirror https://github.com/user_id/new-repo.git

 

❕ 100M 이상 파일 & commit 기록 지우기.

java -jar bfg.jar --strip-blobs-bigger-than 100M

 


출처: https://xtring-dev.tistory.com/entry/Git-GitLab에서-GitHub로-Repository-commit-log를-유지하며-Clone하기

'Git' 카테고리의 다른 글

Fork Repository 최신 업데이트  (0) 2021.04.05
Git branch 옵션 정리  (0) 2021.03.05
Git remote repository 변경  (0) 2021.03.03
Git Repository migration  (0) 2021.02.28
push 된 file 에 .gitignore 적용시키는 방법  (0) 2021.01.22
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG more
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함