Opposite of `git push –mirror`? How do I get my repo back?

I am having great success with git push --mirror to make backup copies to a bare repo. But after search on SO and elsewhere, I cannot find a way to clone the thing locally with all branches. I do not want to use git clone since I don’t want my local repo to know about the bare repo. If I use git pull it only brings down the HEAD branch.


  • Is it possible to sign-off a Merge Commit in Git?
  • Git mirror with gerrit
  • Errors with cabal in Windows with latest Haskell Platform (2014.2.0.0)
  • Command “git status -u no” filters tracked files also
  • Git: Added sub module to a XCode project then GitBox crashes when I open it
  • Git Help UserInterfaceState.xcuserstate: warning: Merge conflict: File still marked as conflicted
  • git pull /data/Dropbox/backup/that_stuff.git *

    gets me nowhere, of course.

    How do I get the entire repo with all branches back again? I realize I could probably just copy the bare repo to my .git directory, but that seems like a bad idea.

  • Accessing Teamcity git Change log in a build step
  • Deleting branches -> safe to edit files in .git/refs/heads?
  • git count files in the staged index
  • Compiling Problems using freeglut
  • How to make msysgit installation a remote repository
  • reset a git repo to an old commit?
  • 3 Solutions collect form web for “Opposite of `git push –mirror`? How do I get my repo back?”

    Try git fetch instead of git pull

    Since git pull is there to fetch a branch and merge it to a local branch, it wouldn’t make alot of sense trying to merge all remote branches to a local branches.

    $ git fetch a-repo_url

    The above command copies all branches from the remote refs/heads/ namespace and stores them to the local refs/remotes/remoteRpo/ namespace, unless the branch.<name>.fetch option is used to specify a non-default refspec..

    $ git fetch a-repo-url +refs/heads/*:refs/heads/*

    could force fetching all heads for all branches.
    See this SO question.

    The OP yar reports:

    git pull /data/Dropbox/backup/mjdj.git/ +refs/heads/*:refs/heads/*


    There’s also (now?) git clone –mirror. But man says:

           Set up a mirror of the remote repository. This implies --bare.

    https://git.wiki.kernel.org/index.php/GitFaq#How_do_I_clone_a_repository_with_all_remotely_tracked_branches.3F describes how to turn bare repo into non-bare.

    You can achieve this with git-copy.

    git copy /data/Dropbox/backup/that_stuff.git that_stuff.git
    Git Baby is a git and github fan, let's start git clone.