git clone --mirror vs git clone --bare

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 acategory 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 acategory, 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 acategory showed up. Winning.

Jason Meridth

jmeridth

My name is Jason Meridth. I am a continuously learning senior software developer/devops/team lead/development manager trying to not let best be the enemy of better. I reserve the right to change my mind upon obtaining more information. I am also the owner and principal software consultant at Meridth, LLC. If you have any software, hardward, networking, process, etc needs please don't hesitate to reach out to me.

Raspberry Pi Kubernetes Cluster - Part 2

Howdy again.Alright, my 8 port switch showed up so I was able to connect my raspberry 3B+ boards to my home network. I plugged it in wit...… Continue reading

Raspberry Pi Kubernetes Cluster - Part 1

Published on April 07, 2018

SSH - Too Many Authentication Failures

Published on March 28, 2018