Keith Rarick

One-Click Cloning

Here’s an easy way to enable all those git:// URIs you see in the git repos.

First, save the following shell script somewhere in your path, name it “git-web-clone”, and make it executable.

Then, register a protocol handler in Firefox:

Visit about:config; right-click and select New → String, enter “network.protocol-handler.app.git” as the name, and “/path/to/git-web-clone” as the value.

Then right-click and select New → Boolean, enter “network.protocol-handler.external.git” as the name, and select true as the value.

For bonus points, let’s register a protocol handler for the rest of Gnome:

$ gconftool-2 --set --type=string /desktop/gnome/url-handlers/git/command '/path/to/git-web-clone "%s"'
$ gconftool-2 --set --type=bool /desktop/gnome/url-handlers/git/enabled true
$ gconftool-2 --set --type=bool /desktop/gnome/url-handlers/git/need-terminal false

Now, clicking on any git:// URI will clone the repo into your work directory. Nice!

Comments