본문 바로가기
프로그래밍

Git Repository 변경하기

by 삼굽살 2022. 2. 20.
반응형

자주 있는 일은 아니지만 Git Repository를 변경해야 할 일이 있다.

단순히 파일만 옮겨가도 되지만 구성해둔 브런치와 히스토리를 전부 가져가고 싶은 경우 --mirror 옵션을 사용해주면 된다.

 

1. 기존 내역 복사하기

git clone --mirror 기존 Repository 주소

ex)
git clone --morror https://soojpark.visualstudio.com/project.git

해당 명령어를 입력하면 아래와 같이 기존 레파지토리가 깊이 복사된다.

 

복사가 완료되면 git 디렉터리에 (프로젝트명). git 파일이 생성되는데,

이 파일명을 .git으로 변경해준다.

 

2. 새로운 Repository 주소 입력

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

ex)
git remote set-url origin http://newRepository/visualstudio.com/project.git

 

3. 새 Repository로 푸시

--mirror 옵션을 사용하여 push 해 준다.

git push --mirror

 

끝~~

 

https://soojpark.tistory.com/9

댓글