30 Mar 2012 - San Antonio
I setup GitWeb at work recently. It is very fast and extremely useful. I noticed that the repositories the web view was looking at didn’t show any tags or other branches. Only the master branch. I had used
git clone --bare git@host:repository.git
to get the code. This ensures that no working directory is created. Pretty much only the contents of the .git directory. In order to get the .git directory but also any tags, non-master branches, etc, I learned to use:
git clone --mirror git@host:repository.git
By definition from the man page of git clone:
--mirror Set up a mirror of the source repository. This implies --bare. Compared to --bare, --mirror not only maps local branches of the source to local branches of the target, it maps all refs (including remote-tracking branches, notes etc.) and sets up a refspec configuration such that all these refs are overwritten by a git remote update in the target repository.
After I used –mirror instead of –bare, the other branches and tags showed up. Winning.