본문 바로가기
카테고리 없음

[GitHub] ☘️깃랩에서 깃허브로 잔디 옮기기(100MB 초과시)

by 옥돔이와 연근이 2025. 4. 2.
728x90
반응형

#### 1️⃣ 아래 사이트에 들어가서 jar 파일 설치

[BFG Repo-Cleaner by rtyley](https://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\]([https://rtyley.github.io/bfg-repo-cleaner/](https://rtyley.github.io/bfg-repo-cleaner/))



#### 2️⃣복사하고자 하는 깃랩의 저장소의 bare clone 생성

```
$ git clone --mirror -b main <옮길 깃랩의 주소>
```

참고로 나의 깃랩은 develop 브랜치로 설정되어있기에 따로 main브랜치로 clone을 받아줌

#### 3️⃣ clone 받은 파일 내부에 다운받은 jar 파일을 넣어줌



#### 4️⃣ commit history에서 large file을 찾아서 tracking 해줌

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

라지 파일이 많으면 여기서 좀 오래 걸림

#### 5️⃣ 트래킹한 파일을 BGF를 이용해서 git lfs로 변경해줌

```
$ cd <.git 폴더 내부> //내부로 이동해주고 
$ java -jar bfg-1.14.0.jar --no-blob-protection --convert-to-git-lfs '*.zip'
$ java -jar bfg-1.14.0.jar --no-blob-protection --convert-to-git-lfs '*.jar'
```

#### 6️⃣ 옮기고 싶은 저장소 (깃 허브)로 push

```
$ git push --mirror <git 저장소>
```

---

참고 사이트: [https://velog.io/@1vl/100mb-넘는-파일이-있는-gitlab-github-미러링](https://velog.io/@1vl/100mb-%EB%84%98%EB%8A%94-%ED%8C%8C%EC%9D%BC%EC%9D%B4-%EC%9E%88%EB%8A%94-gitlab-github-%EB%AF%B8%EB%9F%AC%EB%A7%81)

728x90