tags:

views:

142

answers:

4

I understand that Git can be used without a central repository. However, I am starting a project with several other people, and we are geographically distributed. I.e. We will never be on the same LAN to synch repos.

So my question: Is it possible to push / pull changes from each others repos over the internet? If so, how do I go about it? Easiest non-fuss way.

Thanx in advance.

+3  A: 

You need some kind of "direct" not-nat-ed connection (meaning if you are behind a router it is a problem). If I were you I'd go for github

The help section explains everything nicely.

Ronny
you can be behind a router as long as your in in a dmz zone of the router.
fuzzy lollipop
I don't use it myself, but it's clear from many other questions that users have successfully used git via ssh on windows boxes; the port forwarding is just a quick router setting. Do note that for closed-source projects another option is to pay for private git hosting.
Jefromi
@fuzzy lollipop: Please, please don't open *all* ports to your own computer just to get the single one for SSH opened.
Jefromi
@Jefromi Yes, SSH works great with Git, even with Windows boxen. Just install Cygwin there...
Brian Knoblauch
I can't explain it well, therefor I suggest REALLY using a well supported community site. I mean, there is no pain in that little indirection and get very nice functions for free. There is nothing better. Personally I use it even without collaboration.
Ronny
who said I opened all ports to just get ssh? DMZ doesn't mean all ports are open it means you aren't behind the NAT of the router. You can still close whatever ports you want on the DMZ machine.
fuzzy lollipop
@fuzzy lollipop: On a home router, if you tell it to make a DMZ out of a given computer, it will open all ports to it. Apologies if you were talking about a more robust DMZ with subnet and dual firewall and everything, but it's a bad idea to just suggest to a home user "make a DMZ".
Jefromi
+7  A: 

If you have SSH access to each others' machines (which may be a little easier to set up on some networks than git:// protocol access) then it's as easy as:

git pull ssh://username@host:/path/to/repository/.git

If direct access by any protocol isn't possible (e.g. if you're behind a router with NAT) then you can always send each other patches.

But Git has another way of doing this, git-bundle, which lets you send a file (via email, or however else you send files) to your collaborators which can be pushed and pulled to and from like a repository. The author of Pro Git has a blog post tutorial on this.

Ben James
+4  A: 

If you can ssh to each others' computers, you can do git push/pulls to each other's computers. However, it's not really recommended to have a completely peer-to-peer repository. One of you should maintain a "bare" repository that everyone synchronizes with, otherwise you will run into strange and annoying situations when you push to a repository that someone else is working on.

It's really probably best to use github, unless you are working on something closed-source and can't afford the fees for private repositories.

Tyler McHenry
+2  A: 

I would suggest using a central repository location that you can all push and pull from via ssh. This will prevent the issue mentioned above that are caused by pushing to a repo someone is working in.

See this link for good setup info:

http://toolmantim.com/thoughts/setting_up_a_new_remote_git_repository

Alex Unger