Subject: Behavior of "git push --mirror repo"

From: Sebastian Schuberth <[email-masked]>
Date: Tue, 25 Oct 2011 12:25:10 +0200

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