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.

Guessing:

  • How to synchronize two git repositories
  • Squashing commits far apart in git history
  • After git remote remove, my local commit status changed
  • Is there a good (visual) Git tool for Mac OS X or Windows?
  • Is it possible to do a git-rebase after doing a git-commit
  • Force LF line endings using .gitattributes without losing automatic text/binary inference?
  • 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.

  • `git add` doesn't add files to track on Windows
  • Git - merging into master always produces same conflicts even though fixed last time
  • Git: Pulling from remote
  • How can I pull from one remote and push to another with git?
  • Shared Library in repository with visual studio
  • Git diff partial file name
  • 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..
    Try:

    $ 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/*
    

    works.

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

       --mirror
           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.