One way of duplicating a repository is by forking it -to do that, browse to the repository you wish to duplicate, and click the “Fork” button. The other way to duplicate a Git repository is without forking it by executing a mirror-push command to the newly created repository. In this tutorial, I’ll be explaining how to duplicate a Git Repository without forking it – that’s via mirror-push command.
Duplicate a Git Repository
In order to execute Git commands, you need to download Git Bash and install it. Once done,
Step 1: Launch Git Bash
Step 2: Let’s create a bare clone of the repository that you wish to duplicate
git clone --bare https://github.com/username/repo-you-wish-to-duplicate.git
Step 3: Duplicate a repository using mirror push command, to do that you need to change directory to the bare-cloned repository folder.
Now, mirror or duplicate the repository using the below command.
git push --mirror https://github.com/username/duplicate-repository.git
That’s it! Go to your GitHub account and view the duplicate repository.
Step 4: Well, you don’t need the bare-cloned repository in the local machine, so just go ahead and delete it.