개발/Git

cmd창에서 GitHub 레파지토리 이동하기

오호츠크해 기단 2022. 11. 24. 15:37
728x90

기존 레파지토리(A): https://github.com/mmingidan/swing_cpp

새로운 레파지토리(B): https://github.com/mmingidan/Cpp

 

[명령어]

git clone --mirror {기존 리파지토리 주소}
cd {기존 리파지토리 명}.git
git remote set-url --push origin {신규 리파지토리 주소}
git push --mirror

 

윈도우 cmd창을 띄우고 아래와 같이 명령어를 입력해준다.

git clone --mirror https://github.com/mmingidan/swing_cpp.git
cd HelloOpenCV.git
git remote set-url --push origin https://github.com/mmingidan/Cpp.git
git push --mirror

여기서 git push --mirror 했을 때

신규 리파지토리가 다른 계정의 저장소 일 경우 계정을 입력해야할 수 있다.

+A의 내용을 B로 옮길 때 B에 담긴 파일들이 있다면 그 파일 내용들은 모두 사라지고 B레파지토리에는 A의 내용만 남는다.. 이것 때문에 파일 내용을 다 날렸다..ㅎㅎ

+파일 작성 날짜도 유지되면서 복사된다.