# Behavior of "git push --mirror repo"

2 messages from 2011-10-25 to 2011-10-25. Participants: Sebastian Schuberth.
Thread: https://gitlist.dev/t/28761

## Sebastian Schuberth, 2011-10-25 10:25

Subject: Behavior of "git push --mirror repo"
Message-ID: <j862ts$d75$1@dough.gmane.org>
URL: https://gitlist.dev/e/j862ts%24d75%241%40dough.gmane.org

```
Hi,

I cloned a repository from "origin" to my local disk. I only have a local branch for "master", although there are more remote branches. Now I want to initialize a new empty bare repository with an exact copy of the repository, including all branches, also those remote branches that I have no local branch for. So I did:

$ git remote add sf <url>
$ git push --mirror sf

Which prints:

 * [new branch]      master -> master
 * [new branch]      refs/notes/commits -> refs/notes/commits
 * [new branch]      refs/original/refs/heads/master -> refs/original/refs/heads/master
 * [new branch]      origin/HEAD -> origin/HEAD
 * [new branch]      origin/bourke -> origin/bourke
 * [new branch]      origin/colorscheme -> origin/colorscheme
 * [new branch]      origin/cpuinfo -> origin/cpuinfo
 * [new branch]      origin/demo-ssao -> origin/demo-ssao
 * [new branch]      origin/master -> origin/master
 * [new branch]      origin/mesh-improvements -> origin/mesh-improvements
 * [new branch]      origin/mesh-iterators-subdiv -> origin/mesh-iterators-subdiv
 * [new tag]         gale2-static-dummy-window -> gale2-static-dummy-window

In the target repository "sf" I now alony have the "master" branch and the "gale2-static-dummy-window" tag, but none of the remote branches from "origin". I was reading the --mirror option as if this should happen:

 * [new branch]      origin/bourke -> sf/bourke

etc.

Is this behavior expected? If yes, what the correct way to mirror a repository then (without creating a local branch for each remote branch first)?

Thanks.

-- 
Sebastian Schuberth

```

## Sebastian Schuberth, 2011-10-25 12:46

Subject: Re: Behavior of "git push --mirror repo"
Message-ID: <4EA6AF9E.30201@gmail.com>
URL: https://gitlist.dev/e/4EA6AF9E.30201%40gmail.com
In-Reply-To: <j862ts$d75$1@dough.gmane.org>

```
On 25.10.2011 12:25, Sebastian Schuberth wrote:

> I cloned a repository from "origin" to my local disk. I only have a

Got it: I was missing "--bare" when doing my clone.

-- 
Sebastian Schuberth

```
