git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Behavior of "git push --mirror repo"

From
Sebastian Schuberth <sschuberth@gmail.com>
Date
Oct 25, 2011, 10:25 UTC
Message-ID
<j862ts$d75$1@dough.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
Next: Sebastian Schuberth
Message 1 of 2 in “Behavior of "git push --mirror repo"”
  1. Sebastian SchuberthOct 25, 2011
  2. Sebastian SchuberthOct 25, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.