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:

  • Git diff with line numbers (Git log with line numbers)
  • How do you rename a Git tag?
  • Cannot push git to remote repository: (SSH error)
  • what's difference about git branch -d <branchname> and git branch -D <branchname>
  • How can I do a bugfix on master and integrate it into my less stable branch(es)?
  • GIT Error:- expected committer email '' but found 'karan@xyz.com'
  • 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.

  • How can I get track of several projects in Git that share common code?
  • git-instaweb and git-clone
  • Stop tracking a file in git - without having it deleted either locally or on pull
  • How can I see what branch another branch was forked from?
  • Specification for syntax of git dates
  • Changing Remote Branch To Push To In Netbeans
  • 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.