Env/Tools
github to gitlab
Roiei
2025. 2. 5. 08:23
반응형
github의 모든 branch, tag 내용을 gitlab에 반영하는 방법
다음은 github의 test라는 repository의 모든 branch, tag들을 gitlab의 your repository로 반영하는 과정을 설명합니다.
우선 github의 test repo를 clone 합니다.
# GitHub 프로젝트 클론
git clone https://github.com/test.git
test로 들어가서 모든 branch 내용을 fetch 하여 local로 가져옵니다.
cd test
# 모든 원격 브랜치와 태그 가져오기 및 로컬 추적
git fetch origin
for remote in $(git branch -r | grep origin/ | grep -v '\->'); do
git branch --track "${remote#origin/}" "$remote";
done
이제 test local repo에 branch와 tag 내용을 반영할 gitlab repo를 remote repo로 등록합니다.
git remote add gitlab https://your.gitlab.com/username/repository.git
등록한 gitlab remote repo에 branch와 tag 내용을 모두 push 합니다.
# GitLab 저장소로 모든 브랜치와 태그 푸시
git push gitlab --all
git push gitlab --tags
반응형