tags:

views:

88

answers:

5

Sorry, if this is a FAQ, but I can't find the answer. I'm intrigued by git. I've used nearly all of the usual players over the past decades. Currently on SVN and not really happy.

I think I understand the basics, but I don't understand one key concept: how does a user in his/her house talk to/from my computer (separate houses, ISP, etc.) , when we both have dynamic IP addresses from our ISPs, and use at least one level of firewall/NAT to hide the local network address from the world.

Its not as if there is a useful DNS entry pointing to the other host/PC/laptop. And most (all?) ISPs don't make it obvious how you open ports in general (sure, I can do it in my house, but what about when I'm in a hotel room?)

Any pointer to the answer to this FAQ greatly appreciated.

Thanks pat

+1  A: 

You both talk to a central server (eg, GitHub) using normal outgoing HTTPS requests.

SLaks
no, I am talking about two peers in two locations.Sorry, I don't grok github, that seems to be going back to having a central repository like I have with SVN.
fishtoprecords
@fish On GitHub, you wouldn't have a single, centralized repository. Instead, you and your collaborator would each have an independent clone of the repository. You'd exchange work with pull requests: http://github.com/guides/pull-requests
Greg Bacon
A: 

Make a standalone openvpn tunnel between...

example (without crypto):

box one (server): virtual ip 10.10.11.5

openvpn --float  --ping 30 --ping-exit 300 --inactive 300 --mssfix 1400 --tun-mtu 1500 --mute-replay-warnings --dev tun --comp-lzo --port 3565 --ifconfig 10.10.11.5 10.10.11.6  --proto tcp-server

box two ( client): virtual ip 10.10.11.6

openvpn --remote dynamic_ip_of_server_or_no_ip_hostname --float  --ping 30 --ping-exit 300 --inactive 300 --mssfix 1400 --tun-mtu 1500 --mute-replay-warnings --dev tun --comp-lzo --port 3565 --ifconfig 10.10.11.6 10.10.11.5  --proto tcp-client

then, commit to server over ssh... or smbmount, or NFS mount...

olarva
@olarva: any reason why you're recommending TCP? OpenVPN works faster and easier over UDP, and having NAT on both sides makes TCP a lot harder. (doesn't make UDP easier either; but it's still doable)
Javier
Some routers (like MicroTik, if enabled that feature), drop ptp over udp.
olarva
A: 

three solutions:

  • central cerver (e.g. github)
  • VPN
  • IPv6 (teredo/miredo works perfectly for home setups) + dynDNS (very few do free dynDNS AAAA records, the only one i found was majimoto.net)
Javier
Perhaps I don't grok how a VPN would work. That would take setup on both (all) houses so I can access in, and doesn't address the DNS, DHCP question.IPv6, sure. As if ISPs are actually offering that for consumers.
fishtoprecords
a VPN isn't trivial to setup; you have to handle dynamic IPs (dynDNS is the easiest) and NAT traversal (not too hard with UPD-based VPNs (like OpenVPN), but not trivial of course). with teredo or 6to4 you don't need ISPs help to get a globally routable IPv6 address that makes your NAT almost invisible.
Javier
+2  A: 

This isn't a git question per se. If you were hosting, say, a Subversion repository on your laptop, other developers will still have trouble talking to it while you're in a hotel room. You'll need to make your repos available by tunneling through other protocols or pushing them to mutually accessible resources.

The worst but still operable case is when repos can't talk to each other directly, but you can email patches to each other with git send-email.

Next up the ladder, say you have a shell account with an internet provider that also provides ~/public_html. In that case, you'd create in that webspace a bare repository as described in Setting up a git repository which can be pushed into and pulled from over HTTP(S). Your pushes would be authenticated via SSH, and your collaborators would set up remotes to pull from the appropriate HTTP URL.

That's marginally better than email but slow and klunky. Now git has the benefit of a smart HTTP backend where pulls over HTTP are much faster. With either the smart or the dumb backend, you can enable authentication.

If you don't care about authentication, you could also serve your repository with git daemon from a host that everyone can reach.

If you both have shell access to the same host, you could exchange work directly after connecting to that box. You have many options here:

  • full shell access: same account, same (centralized) repo
  • full shell access: different accounts, separate repos, git pull
  • allow collaborators git-only access to your shell account
  • (and so on)

The above might do in a pinch, but all the manual care and feeding will become tiresome. Outsource that headache to GitHub or Gitorious.

Greg Bacon
A: 

I assume that you are not both on the same local private network, is it?

You can try to set up SSH tunnel, and push/fetch via SSH. You can configure ssh to use non-standard port, and have it exported on your router. You can use one of free dynamic DNS services like DynDNS.

Each of you can set up free account on one of public Git hosting sites like GitHub, push your changes to it when you are ready, and the other would fetch changes from other public repository: this would not need to punch any holes in your firewall / export ports in your router / NAT.

The picture would look similar to this figure from Chapter 5.1 "Distributed Workflows" of Pro Git book, only without the blessed repository and integration manager position, and developers fetching directly from each others public repositories:

lieutenant-diagram


If all else fails, you can always exchange git bundle's using any channel: be it email attachements or USB disk.

Jakub Narębski
Correct, the assumption is that the team is distributed. Different houses, different ISP, different states/countries, etc.I clearly am missing something. GitHub smells a lot like a common SVN repository. I thought GIT was differnet
fishtoprecords
@fishtoprecords: I hope that added diagram makes this clear
Jakub Narębski