Jin's Dev Story

[GitHub] 저장소 repository 옮기기, 이동 (commit 포함) 본문

Tools/GitHub

[GitHub] 저장소 repository 옮기기, 이동 (commit 포함)

woojin._. 2024. 6. 14. 13:03

git repository mirroring

• git 저장소(repository)를 커밋로그 포함, 그대로 옮기는 방법

기존 Repository 복사

git clone 명령어에 --mirror 옵션을 추가해서 실행

$ git clone --mirror "기존 Repository 주소"

명령어를 실행하면 간략한 저장소로 복제한다고 하면서 Repository의 이름으로 .git 디렉터리가 생김 ( "기존 Repository".git ) 해당 디렉터리의 이름을 .git으로 바꾸어 주면 됨

$ mv "기존 Repository".git .git

새 Repository로 연결

git remote의 주소를 새롭게 옮길 Repository 주소로 변경

$ git remote set-url origin "새로운 Repository 주소"

해당 명령어를 실행한 후 정상적으로 변경이 되었는지 확인

$ git remote -v

새 Repository로 복사

git remote의 주소까지 변경이 되었다면 git push 명령어를 이용해 깃에 올려주면 됨 이때 옵션으로는 --mirror옵션을 추가

$ git push --mirror