Git repo law #1: save the time of the puller

Apologies to Ranganathan.

Say you have a Git repository you want to publish, and you’ve set up a Gitweb for it at http://git.example.com/?p=myrepo.git;a=summary.  So far, so good: others can browse your commits and download packages and tarballs.  Suppose you’ve also configured git-daemon(1) to publish the repo using the Git protocol.  Great!  Now suppose you’ve told the world to go to http://git.example.com. The world looks at what you have wrought, and then asks: How can we clone your repository?

Even assuming that you’ve used the default options in your git-daemon configuration, the Git clone URL could be any of the following depending on where your OS distribution’s packagers decided to put things:

  • git://git.example.com/myrepo
  • git://git.example.com/myrepo.git
  • git://git.example.com/git/myrepo
  • git:/git.example.com/git/myrepo.git
  • and there are even more possibilities if you did tweak the config

The rub is that Gitweb doesn’t know and can’t know until you tell it.  If you don’t tell it, somebody who wants to clone your repo and who is looking at the Gitweb page can only guess.  If they guess wrong a few times, they may give up.

Fortunately, the solution is easy: to make the Git clone URL display in your Gitweb, go to the repository’s base directory and create a new file called cloneurl and enter the correct clone URL(s), one per line. While you’re at it, make sure that the description file is accurate as well.

CC BY-SA 4.0 Git repo law #1: save the time of the puller by Galen Charlton is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.