---
title: "Mirror Git repository"
url: https://michalasobczak.pl/posts/mirror-git-repository.html
author: "Michał Sobczak"
description: "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."
published: 2022-08-19T11:04:15.000Z
updated: 2022-09-06T10:43:33.000Z
language: en
categories: ["Technology"]
tags: ["Git"]
license: CC BY-NC-ND 4.0 (https://creativecommons.org/licenses/by-nc-nd/4.0/)
---
# 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.
