DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 966,904 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Ismail PE
Ismail PE

Posted on

Duplicating a github repo with history

It's so easy to duplicate a github repository including every commits and branches.

1) Create a new repo in github using UI/command as usual. This will be the target repo where duplicate of source repo to be pasted.

2) Open a command prompt and Clone the source/existing repo using the command:

git clone --bare https://sourceRepoURL

A new folder will be created containing some files from source repo.

3) Move to that folder:
cd sourceRepoFolder

4) Push these files into the target repo using command:
git push --mirror https://targetRepoURL

That's it. Thank you.

Oldest comments (3)

Collapse
 
ederfdias profile image
Eder Ferreira Dias

Awesome,
Thanks!

Collapse
 
larrynoriega profile image
Larry Noriega

Mate, the very best one instructions out there innit!

Collapse
 
mghdeveloppers profile image
MGH Developpers

Thank you !!
you just saved my day__

You’ve already scrolled down this far, why not join our community of 900k+ developers all learning together?