Me and a couple of other guys from a big team are working on a separate page on the project. Let\'s call it groups page. While we work on the groups page, we need to exchang
3 is your best option. In fact, that's really how Git is intended to be used; with repositories for individual components, which feed into a more central repository when work is done.
There is no problem pushing someone else's changes. Lets say you make a change, and push it to the groups page repository. Then I pull that, make some changes, and push them back. Now we decide we're done. If I push to the central repository, that push will include both my changes, and your changes which my changes were based on.
You do not need to push from one bare repo to another. Git works by pushing from your local repo, to one or more remote repos. When you clone, there's a default remote repo called "origin". But you can have as many remote repos configured as you want. To set this up, let's say you have cloned from the central repo; that's called "origin". Now you create a bare repo: it's at ssh://some-machine.corp.com/path/to/groups-repo.git
. In your local working repo, just do git remote add groups ssh://some-machine.corp.com/path/to/groups-repo.git
, and you will have a reference to that groups repo. Now you can use git fetch
, git pull
, git push
and so on with groups
as well as with origin
.
To make it simple, Git is a distributed version control system. This mean that whenever you clone from a repo, you clone the entire repository. And each clone is completely independent. In fact, what you clone on your machine is exactly the same as what's on the server, your clone can receive push/pull, etc. (Only difference is probably that you won't let anybody connect in via ssh)
So, whichever way you go, if your coworkers pull from you, they can push your commit to the main repo. Same thing will apply with option 3, use your team git server, and when ready, some of you pull to his machine and push from there to the main server.
So, in your case, option 3 would be the easiest. Although, once you push to the main repo, this repo will gave all the work you've done in your private server. So, I'm not even sure it's really useful for you to have your own server (unless you want to make sure nobody else touch your "private" branch).
Is there a way to push from one bare clone to the main github repo?
Yes, you don't have to be in a work tree to push changes from a bare repo.
Simply ssh to the place where you 'local master' is, and run:
git push origin master
As the other answer point out, you can also push directly from your local copy to a remote master, but it's sometimes more convenient to have an automated 'gatekeeper' repository like this that can be triggered to push changes out (eg. after review) to multiple remote repositories via automation, without worrying about setting up ssh keys and so forth for a specific individual to push the changes out.