Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Git push / pull over the internet to distributed repos?

Tags:

git

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.

like image 864
Jacques Bosch Avatar asked Mar 31 '10 19:03

Jacques Bosch


People also ask

Does git push require internet?

When working off line, two Git tasks cannot be performed: fetching/pulling updates from the server, and pushing changes to the server. All other commands still work. One can commit changes, branch off, revert and reset changes, the same as when there exists an internet connection.

Does git push push everything?

By default, git push only updates the corresponding branch on the remote. So, if you are checked out to the main branch when you execute git push , then only the main branch will be updated. It's always a good idea to use git status to see what branch you are on before pushing to the remote.

Does git push push to all remotes?

The objective is to push to multiple Git remotes with a single git push command. If you don't want to create an extra remote named all , you can skip the first command and use the remote origin instead of all in the subsequent command(s). Now, you can push to all remote repositories with a single command!

Does git push push to all branches?

No, git push only pushes commits from current local branch to remote branch that you specified in command.


1 Answers

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.

like image 121
Ben James Avatar answered Nov 15 '22 08:11

Ben James