Git – Using git with SSH and (sometimes) corkscrew


I need to use git over SSH (it's a self-imposed limitation, but one I am loathe to break). If my laptop is sitting on my home network, it all works great. When I'm at work or logged in via VPN, however, I would need to use corkscrew to access my remote repository, which I can set up without problems.

I would like to remain lazy and not specify where I am pulling from/pushing to each time, if possible, so my question is: how can I configure SSH to only use corkscrew when needed (based on, for example, current IP address)? Alternately, is there a way I can have git detect whether or not to pull from/push to a particular host based on IP address?


Best Solution

I solved this problem for myself by setting up a free DynDNS account that points to my server. Then, I clone via that address. This means it works wherever I am. The down side is that even when I am on the same local network as the server, my latop still pulls via DynDNS.

I couldn't come up with a solution that does exactly what you need - setting up multiple remotes and being careful about which one you pull from seemed more complicated than I wanted.