Skip to content

MIRROR A GIT REPOSITORY

Step 1: Create an empty destination repository

Create an empty destination repository (without a README etc.).

Step 2: Clone the repository to mirror

This will create a directory with a .git extension containing all the Git metadata.

git clone --bare https://github.com/EXAMPLE-USER/OLD-REPOSITORY.git

Step 3: Navigate to the the cloned repository

cd OLD-REPOSITORY

Step 4: Set the remote url to push to

git remote set-url --push origin https://github.com/EXAMPLE-USER/MIRRORED

Step 5: Fetch latest updates from source repository

git fetch -p origin

Step 6: Push updates to destation repository

git push --mirror

References

Mirroring a repository in another location