supporting roaming via git URL rewriting

Bruce Schultz bruce.schultz at gmail.com
Thu Dec 22 22:41:29 CET 2011


On 23/12/11 01:16, Adam Spiers wrote:
> Here's another situation in which this inconvenience is more
> pronounced: my main desktop machine "atlantic" is reachable both via
> the LAN and via the internet (using port forwarding from my public
> static IP).  So if I'm on a laptop and pull from it via the LAN, and
> then later leave the LAN and want to pull from or push to it again via
> ADSL, there's more work to be done.
>
> However I just discovered git's URL rewriting feature, which solves
> this by allowing an extra layer of indirection.  I wrote this utility:
>
>   https://github.com/aspiers/git-config/blob/master/bin/git-url-rewrite
>
> Now I can configure a single remote pointing to my desktop machine,
> with URL "atlantic:path/to/repo".  When I leave the house, I run:
>
>   git url-rewrite atlantic: ssh://public.adamspiers.org/home/adam/
>
> and when I get back:
>
>   git url-rewrite atlantic: ssh://atlantic/home/adam/

I solved that situation by adding the external name (ie public.adamspiers.org)
to the DNS on my ADSL router.

So if I'm on my LAN at home, public.adamspiers.org -> 10.0.0.12

But if I'm away from the house, its port forwarded through the router to my
workstation.




More information about the vcs-home mailing list