데굴데굴 굴러가는 개발 블로그

GitLab 에서 Github로 commit 까지 clone 하는법 본문

개발/프로젝트

GitLab 에서 Github로 commit 까지 clone 하는법

Daram-e 2022. 9. 22. 22:50

 프로젝트를 gitlab에서 진행하고 github에다가 커밋 기록(잔디) 까지 가져오고 싶어서 별 노력을 다하다가 계속 안되길래 모든 인터넷의 해결법을 모아서 정리해보도록 한다..

 

깃랩 커밋기록 안 넘어와서 개판난 내 작고 소중한 잔디...

 

대략적인 순서는 다음과 같다 

1. Git lfs와 BFG Repo Cleaner 설치

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://git-lfs.github.com/

 

Git Large File Storage

Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.

git-lfs.github.com

2. 옮기고자 하는 저장소(GitLab) mirror clone

git clone --mirror ${gitlab_저장소_주소}

 

3. 커밋 히스토리에서 100MB 넘는 file 찾아서 tracking  ( .확장자 로 파일을 찾게 함)

git filter-branch --tree-filter 'git lfs track "*.{확장자1,확장자2...}"' -- --all

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

 

4. BFG를 이용해 3번에서 찾은 대용량 파일들을 Git lfs 변경

java -jar ${BFG_Repo_Clener_경로} --convert-to-git-lfs '*.확장자' 

ex) java -jar ${BFG_Repo_Clener_경로} --convert-to-git-lfs '*.zip'

 

5. 새 저장소(Github)로 mirror -push

cd ${gitlab_repository}

git push --mirror ${github_주소}

ex) cd old-repository

git push --mirror https://new-repo.git

 

(위의 과정으로도 해결이 안된다면 해야하는 작업 -> 100M 이상 파일 + commit 기록까지 지워버리기)

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

 

내 소중한 잔디.. 어서와

'개발 > 프로젝트' 카테고리의 다른 글

Vue router-link 에 @click 이벤트 적용  (0) 2022.05.25
Python을 이용한 SQL Database 다루기  (0) 2021.04.06