PromleeBlog
sitemapaboutMe

posting thumbnail
mirror 옵션을 사용해 리포지토리 복제하기
Repository Replication with mirror option

📅
협업 프로젝트를 진행할 때, 주로 Organization을 생성하고 그 안에서 Repository를 생성하여 협업을 진행한다.
프로젝트 종료 후, Reopsitory를 온전히 나의 소유로 가져오고 싶을 때가 있다.
이럴 때, Repository를 Fork하여 가져올 수 있지만 원본 Repository를 계속 관리해야 하는 단점이 있다.
이럴 때 Repository를 --mirror 옵션을 사용하여 내 github에 복사하는 방법을 알아보자.

🚀

새로운 Repository 생성하기🔗

기존 Repository를 복사할 새로운 Repository를 생성한다.
  1. github 로그인 후 다음 링크로 이동 https://github.com/new
  2. 옮겨담을 Repository name을 입력
  3. Public 또는 Private을 선택
  4. Create repository 버튼 클릭
    240606-152842
    240606-152842

🚀

로컬에서 Repository 복사 및 push 하기🔗

  1. 기존에 존재하던
    복사 대상 Repository 주소
    를 복사한다.
    240606-154630
    240606-154630
  2. 본인 컴퓨터에 적당한 위치에 다음 명령어로 clone한다.
    git clone {5번에서 복사한 Repository 주소}
    240606-154920
    240606-154920
  3. clone된 Repository로 이동한다. (여기서는 cd Old_repo)
    cd {Repository 이름}
  4. --mirror 옵션을 사용하여 원본 Repository를 새로운 레포지토리로 push한다.
    git remote set-url --push origin {새로운 Repository 주소}
    git push --mirror
    240606-155454
    240606-155454

🚀

결과 확인🔗

새로 생성한 Repository로 이동하여 정상적으로 push 되었는지 확인한다.
추가적으로 커밋 내역이 정상적으로 복사되었는지 확인한다.
240606-155552
240606-155552

🚀

참고🔗