Please follow the below steps to mirror a repository.

1) Create a new private repo in the destination GitHub account with the same repo name or different name.
2) Open Terminal
3) Create a bare clone of the repository in the terminal with the below command.

git clone --bare https://github.com/exampleuser/old-repository.git

4) Mirror-push to the new repository with the below commands

$ cd old-repository.git
$ git push --mirror https://github.com/exampleuser/new-repository.git

5) Go and check the private repo( which you have created in step-1) of your destination guthub account, you will be seeing the updated code.

6) Remove the temporary local repository you created earlier. This is Optional.

$ cd ..
$ rm -rf old-repository.git

Please find another way of mirroring the repo.

1) Create the private repo in your destination GitHub account. After creating you will get the page which is in the screenshot.

2) Goto the bottom and click on “import code”. After that you will get the page which is in the screenshot.

3) Provide the old repo clone URL and click on “Begin import”. You repo will be imported with in seconds.

4) Goto new repo and check for the updated code.

Leave a Reply