Mirroring a git repository in another location

## If you want to mirror a repository in another location, including getting updates from the original, you can clone a mirror and periodically push the changes. ## Open Terminal. ## Create a bare mirrored clone of the repository. $ git clone --mirror https://github.com/exampleuser/repository-to-mirror.git ## Set the push location to your mirror. $ cd repository-to-mirror.git $ git remote set-url --push origin https://github.com/exampleuser/mirrored ## As with a bare clone, a mirrored clone includes all remote branches and tags, but all local references will be overwritten each time you fetch, so it will always be the same as the original repository. Setting the URL for pushes simplifies pushing to your mirror. To update your mirror, fetch updates and push. $ git fetch -p origin $ git push --mirror

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.