Creating Twin Repositories


How to create a twins repository that includes both branch and tag. 🙍🙍

Test environment

Grammar

$ 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>

Demo

$ 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 ✅ The repository must be created in advance.

$ 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

👥 Result