git submodule quite a lot. In particular, for my
dotfiles repository, in which I have tons
of dependencies to external packages, for example from the
emacsmirror project. Of course, I also wrote
some of the packages, or need to point a repository where my personal
This I achieve by having submodules like the following (from my
[submodule "_emacs.d/packages-src/magit"] path = _emacs.d/packages-src/magit url = git://github.com/sigma/magit.git
Now something that’s been bugging me is the choice between allowing people to
clone the entire thing seamlessly (meaning using the public URL of the
repository, as above), and being able to hack directly inside the submodule
(which would require to use the private URL, like
firstname.lastname@example.org:sigma/magit.git). Since submodules only have one URL, I had
no big hope.
But the clever git developers actually have
a solution (from git 1.6.5 apparently). I just had to add this to my
.gitconfig, and everything works transparently !
[url "email@example.com:sigma/"] pushInsteadOf = git://github.com/sigma/
What it does is extremely simple actually whenever I’m trying to push to the
anonymous version of one of my repositories (they all live under
ssh-based version is used instead. So I can only refer to anonymous URLs in my
submodules, and everyone is happy. Note that there’s a more general
insteadOf setting, that does the same operation for both read and write
documentation for details.
Like it. A lot.