Git 저장소 복제 (부제: 쌍둥이 저장소 만들기)

·2020년 1월 13일
1
post-thumbnail

branch, tag 를 모두 포함한 복제 저장소 생성 방법을 공유합니다. 🙍🙍

테스트 환경

문법

$ git clone --mirror <org_repository>
$ cd org_repository
$ git remote -v
$ git remote set-url --push origin <new_repository>
$ git remote -v
$ git push --mirror <new_repository>

데모

$ git clone https://github.com/sarojaba/awesome-devblog.git
Cloning into 'awesome-devblog'...
remote: Enumerating objects: 136, done.
remote: Counting objects: 100% (136/136), done.
remote: Compressing objects: 100% (88/88), done.
remote: Total 7219 (delta 81), reused 87 (delta 48), pack-reused 7083
Receiving objects: 100% (7219/7219), 2.59 MiB | 2.28 MiB/s, done.
Resolving deltas: 100% (4595/4595), done.
$ cd awesome-devblog
$ git remote -v
origin  https://github.com/sarojaba/awesome-devblog.git (fetch)
origin  https://github.com/sarojaba/awesome-devblog.git (push)

https://github.com/leechungkyu/new-awesome-devblog.git 저장소는 미리 만들어둬야 합니다. ✅

$ git remote set-url --push origin https://github.com/leechungkyu/new-awesome-devblog.git
$ git remote -v
origin  https://github.com/sarojaba/awesome-devblog.git (fetch)
origin  https://github.com/leechungkyu/new-awesome-devblog.git (push)
$ git push --mirror https://github.com/leechungkyu/new-awesome-devblog.git
Delta compression using up to 2 threads.
Compressing objects: 100% (2586/2586), done.
Writing objects: 100% (7219/7219), 2.59 MiB | 1.52 MiB/s, done.
Total 7219 (delta 4595), reused 7219 (delta 4595)
remote: Resolving deltas: 100% (4595/4595), done.
To https://github.com/leechungkyu/new-awesome-devblog.git
 * [new branch]      master -> master
 * [new branch]      origin/HEAD -> origin/HEAD
 * [new branch]      origin/gh-pages -> origin/gh-pages
 * [new branch]      origin/master -> origin/master

👥 결과 화면

git01.png

1개의 댓글

comment-user-thumbnail
2024년 5월 2일

감사합니다! 덕분에 쉽게 저장소 복제했습니다 :-)

답글 달기