Mirror Git repository

If you need to mirror remote repository and push it to another remote repo, then there is one thing you should do to be able to export all remote branches and not only the master.

Bash
git remote add NAME URL
for remote in `git branch -r `; do git branch --track $remote; done
git push --all NAME

It will push all things remotely, but it varies from version to version so better double check.

View as Markdown

All the content on this website is licensed under Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0). Cite as: Michał Sobczak, “Mirror Git repository”, 19 August 2022, https://michalasobczak.pl/posts/mirror-git-repository.html